Created
October 31, 2011 13:56
-
-
Save rustygeldmacher/1327546 to your computer and use it in GitHub Desktop.
Show the current git branch in your prompt (based on http://www.jonmaddox.com/2008/03/13/show-your-git-branch-name-in-your-prompt/)
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
function get_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' | |
} | |
function gitify_prompt { | |
local WHITE="\[\033[1;37m\]" | |
local LIGHT_GRAY="\[\033[0;37m\]" | |
PS1="\h:\W$WHITE\$(get_git_branch)$LIGHT_GRAY\$ " | |
PS2='> ' | |
PS4='+ ' | |
} | |
gitify_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment