Skip to content

Instantly share code, notes, and snippets.

@alxsimo
Last active November 24, 2015 10:10
Show Gist options
  • Save alxsimo/b26e5dd19d929f66747c to your computer and use it in GitHub Desktop.
Save alxsimo/b26e5dd19d929f66747c to your computer and use it in GitHub Desktop.
[GIT] Bash actual branch
# edit .bashrc
export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ "
# with colors
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\] \[\033[33;1m\]\w\[\033[m\] (\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)) \$ "
# reload .bashrc
source ~/.bashrc
or
. ~/.bashrc
Source: https://gist.github.com/justintv/168835
More: http://code-worrier.com/blog/git-branch-in-bash-prompt/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment