Last active
December 21, 2015 23:29
-
-
Save bhavanki/6382306 to your computer and use it in GitHub Desktop.
.bashrc snippet to include the current Git branch in the 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
parse_git_branch() { | |
git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1 /' | |
} | |
gitps1() { | |
local GREEN="\[\033[0;32m\]" | |
local DEFAULT="\[\033[0m\]" | |
PS1="[\u@\h \W]$GREEN\$(parse_git_branch)$DEFAULT\$ " | |
} | |
gitps1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment