The term "porcelain" appears occasionally in the Git documentation. What does it mean?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
Greg Hewgill's answer is exactly correct. Note that there are alternative porcelains available for Git, including Easy Git, yap, pyrite, and vng. Each is intended to make Git easier to learn/use for some part of the community. Links to all of these projects is on the Easy Git page: http://people.gnome.org/~newren/eg/.
"Porcelain" is the material from which toilets are usually made (and sometimes other fixtures such as washbasins). This is distinct from "plumbing" (the actual pipes and drains), where the porcelain provides a more user-friendly interface to the plumbing.
Git uses this terminology in analogy, to separate the low-level commands that users don't usually need to use directly (the "plumbing") from the more user-friendly high level commands (the "porcelain").
More importantly, the term "porcelain" applies to high-level commands, with output:
That is key: if you script, you should use if possible plumbing commands, with stable outputs. Not porcelain commands.
However, you can use the output of a porcelain command which has a
--porcelain
option in script (see below), like:See "How do I programmatically determine if there are uncommitted changes?" as an example to using plumbing commands instead of porcelain ones.
Note: A porcelain command can have a
--porcelain
option.For instance:
git status --porcelain
, which designates an output meant to be parsed.The thread mentioned above details:
That reflects the need, for git users, to using porcelain commands in their scripts!
But only with stable output (with
--porcelain
)As commented by william-berg, the same goes for
git push
!As John Glassmyer proposes in the comments:
And that could be supported by the very first case of "
--porcelain
option" introduction(before
git status --porcelain
, commit 6f15787, September 2009, git 1.7.0,before
git push --porcelain
, commit 1965ff7, June 2009, git 1.6.4):git blame --porcelain
:Commit b5c698d, October 2006, git 1.4.4
The coinage and usage of the term "porcelain" in git was actually by Mike Taht, while otherwise losing a heated argument with Linus Torvalds.
http://www.gelato.unsw.edu.au/archives/git/0504/0881.html
--Porcelain, Git Wiki
Porcelain commands are designed for human consumption, as opposed to commands whose output is easy for computers to parse.
git status
would be one example.