Skip to content

Instantly share code, notes, and snippets.

@JJ
Forked from justintv/.bashrc
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JJ/10503789 to your computer and use it in GitHub Desktop.
Save JJ/10503789 to your computer and use it in GitHub Desktop.
# If you work with git, you've probably had that nagging sensation
# of not knowing what branch you are on, or worse, you pull the wrong branch.
# Worry no longer!
export PS1="\\w<\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)>$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one.
#~/txt/ocio/HashSlash<master>$ git checkout writer
#Switched to branch 'writer'
#~/txt/ocio/HashSlash<writer>$ git checkout master
#Switched to branch 'master'
#I found this a bit cleaner than the original.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment