robertgzr / porcelain

a git status parser
MIT License
34 stars 7 forks source link
command-line git-status

porcelain

Parses git status --porcelain=v2 --branch and outputs nicely formatted strings for your shell.

screen_shot

The minimum git version for porcelain v2 with --branch is v2.13.2. Otherwise you can use the old porcelain v1 based parser on the legacy branch.

With a working Go environment do: go get -u github.com/robertgzr/porcelain

Binaries can be found here.

Installation

make install

On Gentoo there is an ebuild in my personal overlay.

Output explained:

 <branch>@<commit> [↑/↓ <ahead/behind count>][untracked][unmerged][modified][dirty/clean]

Definitions taken from: https://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_dirty

Notice

In some fonts individual characters may look different, so it is important to use a powerline font. They are available:

Usage

Run porcelain without any options to get the colorful output :) For all supported options see porcelain -h.

I run this in ZSH to fill my RPROMPT, for this the terminal color codes need to be escaped. Use the -bash and -zsh flags to do that.

To use it in your tmux statusline you can turn off colors with no-colors or switch to tmux color formatting -tmux.

If you're using tpm you can install it as a plugin:

set -g @plugin 'robertgzr/porcelain'

And then add #{porcelain} to your statusline configuration.

This installs the latest version into the tpm plugin directory.


The screenshots use: