3 ms·
I have my current git branch display as part of my command prompt when I'm in a project directory. parse_git_branch() { git branch 2> /dev/null | sed -e '/^[
by stretchwithme 12y ago
I have my current git branch display as part of my command prompt when I'm in a project directory.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^]/d' -e 's/ \(.*\)/(\1)/'
}
export PS1="\u@\h \[\033[32m\]\$(parse_git_branch)\[\033[00m\] \W $ "
- finnh 12y agoYou might want __git_ps1. Similar idea, but more functionality & maintained by someone else!