Created
November 26, 2012 15:21
-
-
Save jumanjiman/4148753 to your computer and use it in GitHub Desktop.
2 ways to show git branch in PS1 bash 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
# show git branch in shell prompt | |
# ref: https://home.regit.org/technical-articles/git-for-the-newbie/ | |
export PS1='[\u@\h:\W$(__git_ps1 " (%s)")]\$ ' | |
# ref: https://fedorahosted.org/pulp/wiki/GitGuide | |
export PS1="[\u@\h \W\$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/{\1}/')]\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
posh-git rocks...you don't have something like that for bash?