Skip to content

Instantly share code, notes, and snippets.

@morganp
Forked from justintv/.bashrc
Created June 29, 2010 13:17
Show Gist options
  • Save morganp/457197 to your computer and use it in GitHub Desktop.
Save morganp/457197 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. Worry no longer!
PS1='\[\033[01;32m\]\h \[\033[01;34m\]\W' #\$ \[\033[00m\]'
PS1=$PS1"\$(git branch 2>/dev/null | grep '^*' | colrm 1 2 | xargs -I {} echo ' (\[\033[01;31m\]'{}'\[\033[01;34m\])')"
export PS1=$PS1" \$ \[\033[00m\]"
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty!
# host ~/code/web (beta_directory) $ git checkout master
# Switched to branch "master"
# host ~/code/web (master) $ git checkout beta_directory
# Switched to branch "beta_directory"
# host ~/code/web (beta_directory) $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment