Skip to content

Showing the git branch in the zsh prompt

Tuesday, 18 August 2009  |  David Faure

One big risk with git is forgetting which branch you're working in. Several people solve that by putting the git branch in their shell prompt. But often they do that by calling git branch and parsing its output, which is quite slow, especially in big repositories (we strace'd it, and it really opens and reads a lot of files).

At GCDS, together with Aurélien Gateau et Sébastien Renard, we came up with this light-weight implementation (

Requires findup, which you can get from the same directory