3 ms·
Try this: export PS1='\w:$(__git_ps1 "%s")$ ' EDIT - here's mine btw: function parse_git_dirty { git diff --quiet HEAD &>/dev/null [[ $? == 1 ]]
by davidmathers 17y ago
Try this:
export PS1='\w:$(__git_ps1 "%s")$ '
EDIT - here's mine btw:
function parse_git_dirty {
git diff --quiet HEAD &>/dev/null
[[ $? == 1 ]] && echo "✎ " || echo "➜ "
}
function parse_git_branch {
local branch=$(__git_ps1 "%s")
[[ $branch ]] && echo "$branch$(parse_git_dirty)"
}
PS1='\u@\h $(parse_git_branch)\W $ '
If the branch has local changes it shows the pencil, in addition to the branch name. I'm still experimenting.