Created
January 18, 2016 20:01
-
-
Save jeromeetienne/af7963b883108e3f707d to your computer and use it in GitHub Desktop.
include current git branch in your bash config
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
# to add the git branch in the prompt | |
__git_ps1(){ | |
local b="$(git symbolic-ref HEAD 2>/dev/null)"; | |
if [ -n "$b" ]; then | |
printf "(%s)" "${b##refs/heads/}"; | |
fi | |
} | |
export PS1='\u@\h:\w$(__git_ps1 " (%s)")\$ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment