Created
June 20, 2022 09:23
-
-
Save gsw945/71842db7ca9fc0bddd4e30bfe57e1d1f to your computer and use it in GitHub Desktop.
git show branch in bash
This file contains 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
# append to ~/.bashrc | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
export PS1="${PS1:0:-1}\[\033[33m\]\$(parse_git_branch)\[\033[00m\] " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment