ZSH/Prezto git dirty prompt info

Zsh is fun, Prezto makes it even more fun. You should check it out if you haven't.

My prompt includes some git information when relevant. Things like how long since the last commit, the current branch, whether I've added or modified files. I also like to have two symbols, a green tick and a red lightning bolt visible as a general "you should commit your work" flag.

After upgrading Prezto recently, my prompt stopped flagging my Git repos as dirty if I modified a tracked file. It would only consider it dirty if I had untracked files in the repo dir. See below, after I modify file a , the symbol next to the branch is still a tick.

Prompt without fix

At first I thought this was a Git issue since I upgraded both at the same time but it turns out some modifications were made to Prezto's git-info command. This issue (see bottom) on the prezto mainline outlines the changes, though the naming was changed. modules/git/git-info should be the one true reference.

To return your prompt to the old style, add this line to your prompt setup,

zstyle ':prezto:module:git:info' verbose yes

Now when you modify a tracked file, you'll see that the repo is considered 'dirty'.

Prompt with fix

Note: The change was made so git-info was faster, so you might see a performance decrease after enabling the verbose style if you have a huge repo.

Written 5th of August, 2013