Skip to content

Instantly share code, notes, and snippets.

@saidie
Last active December 20, 2015 22:49
Show Gist options
  • Save saidie/6207958 to your computer and use it in GitHub Desktop.
Save saidie/6207958 to your computer and use it in GitHub Desktop.
Show a git branch in bash prompt.
GIT_BRANCH='`git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/^* \(.*\)$/(\1)/"`'
PS1="[\u@\h \W$GIT_BRANCH]\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment