Skip to content

Instantly share code, notes, and snippets.

@markcerqueira
Last active December 14, 2015 22:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save markcerqueira/4bdef6cd1c1d19c1c45c to your computer and use it in GitHub Desktop.
Useful git branch stuff for your bash_profile
# displays handy info when in git directories
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/'
}
function parse_hg_branch {
hg branch 2> /dev/null | sed 's/..*/\ \[&\]/'
}
function prom1 {
PS1="\w\
\$(parse_git_branch)\$(parse_hg_branch) "
}
prom1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment