irongit

a bin full of cool programs

'git str shows detatched now '

huncholanehuncholaneauthored
parent 455a3a6commit c05693b2538eb9ef44de65b0e05101a51fea6cabBrowse files

1 file changed, +6 -0

+6-0bin/git_branch_str
@@ -1,5 +1,11 @@
11 #!/bin/bash
22 branchname=$(git branch --show-current 2>/dev/null)
3+if [[ $? -ne 0 ]]; then
4+ exit 1
5+fi
36 if [[ -n $branchname ]]; then
47 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)"
511 fi