Linux shell git prompt

From PeerFreedom Wiki
Jump to navigation Jump to search

Simple:

PS1="${PS1}"' \[\033[01;33m\]($(__git_ps1 "%s")) '


Fancy prompt:



PS1='${debian_chroot:+($debian_chroot)}\[\033[01;30m\][$(date +%m-%d_%H:%M:%S)]\[\033[01;38m\]'
PS1="${PS1}"'user' # or '\u'
PS1="${PS1}"'@\[\033[01;34m\]host\[\033[00m\]:\[\033[01;32m\]\w\[\033[01;33m\]($(__git_ps1 "%s"))'


PS1="${PS1}"'\[\033[00m\] \$ '

The best:

PS1='\[\033[1;36m\]\u@\h:\[\033[0m\]\[\033[1;34m\]\w\[\033[0m\]\[\033[1;32m\] $(__git_ps1)\[\033[0m\]\$ '