a bin full of cool programs
'git str shows detatched now '
1 file changed, +6 -0
+6-0bin/git_branch_str
| @@ -1,5 +1,11 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | branchname=$(git branch --show-current 2>/dev/null) |
| 3 | +if [[ $? -ne 0 ]]; then | |
| 4 | + exit 1 | |
| 5 | +fi | |
| 3 | 6 | if [[ -n $branchname ]]; then |
| 4 | 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)" | |
| 5 | 11 | fi |