| 1 | |
| 2 | branchname=$(git branch --show-current 2>/dev/null) |
| 3 | if [[ $? -ne 0 ]]; then |
| 4 | exit 1 |
| 5 | fi |
| 6 | if [[ -n $branchname ]]; then |
| 7 | echo -e "(\e[3;32m$branchname\e[0m)" |
| 8 | else |
| 9 | branchname=$(git branch | grep -oP '(?<=\().*(?=\))') |
| 10 | echo -e "(\e[3;38;5;196m$branchname\e[0m)" |
| 11 | fi |