Git info in your ZSH Prompt
briancarper.net
briancarper.net
It's implemented in bash but I use it with almost no modification with the Korn shell.
Recently ZSH support has been added to git-completion.bash, but it's still only in the "next" branch of git: http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/...
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
export GIT_PS1_SHOWDIRTYSTATE=yes
export GIT_PS1_SHOWUNTRACKEDFILES=yesI have a bunch of abbreviations for common git commands, though, so I guess it balances out.
I have git status in my prompt but also use short shell aliases. If anyone's curious:
http://github.com/samsonjs/config/blob/master/zsh/zshrc#L230...
When I want to fiddle with minor configuration details, hey, bash and zsh users have nothing on emacs. ;)
On the other hand, in this case I frequently just use 'git status' which reports my branch anyway among other info I want to double-check just in case I somehow forgot, and this is really just a neat shell trick rather than being really useful, like the one that prints a green ':)' when the last command succeeded and a red ':(' when it failed...
(1) How long the last command took (approx, as there's time between the prompt showing and me putting in a command)
(2) How long ago I ran the last command in a given shell window
My prompt on localhost is always "$ " or "# ", but I add user and host on remote machines to avoid making any big mistakes on the servers I manage.
* Mine currently says:
3.1 pra | 0:ksh 1:top 2:ksh 4:ksh- 5:w3m* | . 1.45, 1.57, 1.01 . 2010-10-07 23:07
which has system load, time, battery (on laptops), etc. "pra" = "pranaferox", my desktop. (I usually have a lot more shells open than that, but I turned everything off while installing a new light in the ceiling earlier.)http://github.com/robbyrussell/oh-my-zsh
Has all sorts of themes, and most have git status.