Last active
December 14, 2015 12:59
-
-
Save marek-saji/5090416 to your computer and use it in GitHub Desktop.
Add this to your .bashrc to include current git tag/branch in shell prompt.
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
PS1_git() { | |
BRANCH="$( git rev-parse --abbrev-ref HEAD 2>/dev/null )" | |
BRANCH="$( git describe --abbrev=0 --tags --match="$BRANCH-*" 2>/dev/null || echo "$BRANCH" )" | |
test -n "$BRANCH" && echo "($BRANCH) " | |
} | |
PS1="\[\033[0;34m\]\$( PS1_git )\[\033[0m\]$PS1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment