Last active
August 29, 2017 05:40
-
-
Save musemby/c2022bf8e8dfab1ea6a321890f21a577 to your computer and use it in GitHub Desktop.
Show the current git branch you are working on
This file contains hidden or 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
# indicates which git branch one is currently working on | |
# e.g musemby@server:~/scripts/ (fix-weird-bug)$ (currently on the fix-weird-bug branch) | |
# paste this into the .bashrc file and source it | |
function parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
GREEN="\[\033[0;32m\]" | |
NO_COLOR="\[\033[0m\]" | |
LIGHT_CYAN="\[\033[0;96m\]" | |
PS1="$GREEN\u@\h$NO_COLOR:\w$LIGHT_CYAN\$(parse_git_branch)$NO_COLOR\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment