Created
September 27, 2017 13:04
-
-
Save sideshowcoder/4fe517741194a6ac0e6f683e3a3a2af2 to your computer and use it in GitHub Desktop.
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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="\u@\h \w\$(parse_git_branch) \\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some additions ;-)
1- use single quote on PS1 for cleaner syntax
2- path display: If you are in a git repository, it will replace the path by:
[root_of_your_repo]/relative/path
3- when you have modified your repo, it display [!] after the name of the branch
enjoy !