Skip to content
a git status parser
Go Shell Makefile
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Update deps (fatih/color fork) Jan 26, 2020
.goreleaser.yml Add tmux plugin for tpm Sep 7, 2018
Gopkg.lock Add tmux output formatting May 6, 2018
Gopkg.toml Add tmux output formatting May 6, 2018
LICENSE Add LICENSE Jul 3, 2017
Makefile Fix goreleaser not setting version vars Oct 11, 2018
README.md Add powerline font notice to README.md (#6) Oct 6, 2018
git.go Fix work tree detection Oct 11, 2018
go.mod Update deps (fatih/color fork) Jan 26, 2020
go.sum Update deps (fatih/color fork) Jan 26, 2020
main.go Fix goreleaser not setting version vars Oct 11, 2018
parse.go Improve logging May 6, 2018
parse_test.go Switch to porcelain v2 Jul 3, 2017
porcelain.go Split out cli code and add version flag Oct 11, 2018
porcelain.tmux Revert f4ae3f1 Oct 11, 2018
porcelain_test.go housekeeping: update go.mod and fix smoke test Oct 11, 2018

README.md

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.

Output explained:

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

  • ? : untracked files
  • : unmerged : merge in process
  • Δ : modified : unstaged changes

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

  • : dirty : working tree contains uncommited but staged changes
  • : clean : working tree corresponds to the revision referenced by HEAD

Notice

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

  • From Source
  • via apt package: apt install fonts-powerline
  • via dnf package: dnf install powerline-fonts

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:

You can’t perform that action at this time.