Created
November 15, 2022 14:32
-
-
Save drblue/76605dead9a76c493dcc718819230120 to your computer and use it in GitHub Desktop.
Git-prompt for bash
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
function git-branch-name { | |
git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3 | |
} | |
function git-branch-prompt { | |
local branch=`git-branch-name` | |
if [ $branch ]; then printf " [%s]" $branch; fi | |
} | |
PS1="\u@\h \[\033[0;36m\]\w\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[0m\] \$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment