Skip to content

Instantly share code, notes, and snippets.

@valakirka
Created July 30, 2010 09:01
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 valakirka/500191 to your computer and use it in GitHub Desktop.
Save valakirka/500191 to your computer and use it in GitHub Desktop.
# In your .bash_profile or .bashrc
# show active git branch in prompt
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
# customize the prompt variable
export PS1="\u@\h:\w \$(git_branch)$ "
# This shows a prompt like this one :)
# valakirka@miskatonic:~/Projects/monquartier (master) $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment