Skip to content

Instantly share code, notes, and snippets.

@jeromeetienne
Created January 18, 2016 20:01
Show Gist options
  • Save jeromeetienne/af7963b883108e3f707d to your computer and use it in GitHub Desktop.
Save jeromeetienne/af7963b883108e3f707d to your computer and use it in GitHub Desktop.
include current git branch in your bash config
# 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