show git current branch and dirty state indicator

.bashrc:

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w$(__git_ps1 " (%s)")\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s)")\$ '
fi

export GIT_PS1_SHOWDIRTYSTATE=1 to show unstaged (*) and staged (+) changes next to the branch name.

export GIT_PS1_SHOWUNTRACKEDFILES=1 to show untracked files (%).

read /etc/bash_completion.d/git for more.

你可能感兴趣的:(current)