2 ms·
You can also use Git's own __git_ps1 from git-completion.bash in either bash or in zsh (see my other comment). Here's an example of it in use: http://github.com
by avar 16y ago
You can also use Git's own __git_ps1 from git-completion.bash in either bash or in zsh (see my other comment). Here's an example of it in use: http://github.com/avar/dotfiles/blob/master/.bashrc#L86 http://github.com/avar/dotfiles/blob/master/.bashrc#L86
It doesn't give you info about whether you have staged files (but maybe it should). But it gives you a bunch of other neat stuff, like whether you're in a git-rebase or git-am operation
- gruseom 16y agoIt definitely can tell you whether you have staged files, because I use it for that among other things. I don't remember how I turned that feature on, but it wasn't hard. Perhaps someone will chime in with the details.
- l0stman 16y agoJust add the following lines in your .bashrc: export GIT_PS1_SHOWDIRTYSTATE=yes export GIT_PS1_SHOWUNTRACKEDFILES=yes
- avar 16y agoThanks. I didn't know about those. I've configured them in my ~/.bashrc now: http://github.com/avar/dotfiles/commit/43454870 http://github.com/avar/dotfiles/commit/43454870