Skip to content

Instantly share code, notes, and snippets.

@jstirk
Created September 18, 2009 07:50
Show Gist options
  • Select an option

  • Save jstirk/188931 to your computer and use it in GitHub Desktop.

Select an option

Save jstirk/188931 to your computer and use it in GitHub Desktop.
Bash prompt from my .bashrc file
# Add our current git branch out to our path
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
condense_path() {
pwd | sed "s/\/home\/$USER/~/" | sed -r "s|(\/?)(.[^\/]{0,3})[^\/]*(\/)|\\1\\2\\3|g"
}
PS1="\\[\\033[01;32m\\]\\u@\\h\\[\\033[01;34m\\] \$(condense_path)\\[\\033[01;33m\\]\$(parse_git_branch)\\[\\033[01;34m\\] \\\$\\[\\033[00m\\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment