What does the term "porcelain" mean in Git?

Viewed 109450

The term "porcelain" appears occasionally in the Git documentation. What does it mean?

9 Answers

Simple Explanation

  • "Porcelain" commands should NOT be relied on when scripting: (because they are likely to change; they and are meant for humans, not machines).
  • "Plumbing" commands should be used for scripting, (because they are more stable / less likely to change).

yeah, but what about the confusing --porcelain option!?

If you want to:

  1. use a porcelain command (meant for humans, not parsing) AND
  2. parse it reliably

....then you can add the --porcelain option and use the output for scripting.

Example: I may use git status --porcelain and use the output for scripting, no problem.

(I say this with the utmost respect to the creators of git. it is easy to criticize, especially if no alternative is specified. But to me, the flags seem confusing.)

Where does porcelain/plumbing terminology come from?

  • If English is not your first language then Greg Hewgill explains it perfectly.
  • For greater detail: checkout VonC's answer.

There are two distinct meanings of porcelain in git.

These two meanings, while it can be argued are not strictly contradictory, can appear contradictory.

A. Conceptual (plumbing vs porcelain)

The official Pro Git book:

But because Git was initially a toolkit for a version control system rather than a full user-friendly VCS, it has a number of subcommands that do low-level work and were designed to be chained together UNIX-style or called from scripts. These commands are generally referred to as Git’s “plumbing” commands, while the more user-friendly commands are called “porcelain” commands.

B. --porcelain / =porcelain options

Many git commands come with a --porcelain option which is meant for scripting.

git status' documentation:

--porcelain[=<version>]

Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git versions and regardless of user configuration. See below for details.

git diff's documentation:

--word-diff[=<mode>]

porcelain

      Use a special line-based format intended for script consumption.

Related