Last active
November 24, 2015 10:10
-
-
Save alxsimo/b26e5dd19d929f66747c to your computer and use it in GitHub Desktop.
[GIT] Bash actual branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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