Put working git branch in shell prompt for bash and zsh?

Craig Rodrigues rodrigc at FreeBSD.org
Fri Dec 4 17:30:35 UTC 2015

On Fri, Dec 4, 2015 at 6:22 AM, Bartek Rutkowski <robak at freebsd.org> wrote:

> Check out 'zprezto' ZSH config framework with 'sorin' theme activated,
> you'll love it :)

Wow!  I love it!

Here is what I did:

(1)  Followed instructions for setting up zprezto at:
(2)  In $HOME/.zshrc put this line near the top so that zprezto is properly

          source ~/.zprezto/init.zsh

After that, when I changed directories into a git checkout, it puts the
branch in the prompt like this:

I didn't like the default prompt, because it was too "busy".
So, I did some additional customizations:

(3)  In $HOME/.zpreztorc , put this line:

zstyle ':prezto:module:prompt' theme 'minimal'

That's it!

Now I can do this:

~/checkouts » cd $HOME/checkouts
~/checkouts » pwd
~/checkouts » cd m2crypto
checkouts/m2crypto - [setuptools] » git branch
* setuptools
checkouts/m2crypto - [setuptools] » git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
checkouts/m2crypto - [master] »


There are a lot of blogs out there for zprezto, so obviously there
is more customization that I can do.

However, I was able to quickly get the behavior I wanted without too much



More information about the freebsd-git mailing list