Created
April 25, 2016 20:56
-
-
Save raidzero/04255d3945d2a2118b70ed6a0c8d3de2 to your computer and use it in GitHub Desktop.
show git branch in 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
function get_git_branch_prompt() { | |
echo " `git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\(\1\)\ /'`" | |
} | |
function git_prompt { | |
local __git_branch='`get_git_branch_prompt`' | |
export PS1="\@ \W\[\033[32m\]$__git_branch\[\033[00m\]\$ " | |
} | |
git_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment