Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save masugadesign/304829 to your computer and use it in GitHub Desktop.
Save masugadesign/304829 to your computer and use it in GitHub Desktop.
.bash_profile prompt (remote server, Git branch)
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# non git dir: user@host.server.com:~/var/www: _
# in git dir: user@host.server.com:~/var/www/site.tld (branchname): _
PS1="\[\e[01;31m\]\u@\H:\w\$(parse_git_branch): \[\e[00m\]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment