Last active
May 26, 2020 22:12
-
-
Save yehee/e1445ccb7a70ee4847ddd67738088e07 to your computer and use it in GitHub Desktop.
Show git branch and short-hand status on terminal command prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias co="cd ~/code" | |
B="\e[38;5;35m" | |
C="\e[38;5;50m" | |
D="\e[38;5;199m" | |
E="\[\033[00m\]" | |
b() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
s() { | |
git status -s 2> /dev/null | ( ! grep ^ ) > /dev/null && printf "$C ✔" || printf "$D ✗" | |
} | |
export PS1="\u@\h \W$B\$(b)\$(s)$E " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment