官术网_书友最值得收藏!

Porcelain commands and plumbing commands

Git, as we know, has a myriad of commands, some of which are practically never used by the average user; as by example, the previous git cat-file. These commands are called plumbing commands, while those we have already learned about, such as git add, git commit, and so on, are among the so-called porcelain commands.

The metaphor originates directly from the fervent imagination of Linus Torvalds, the dad of Git, and has to do with plumbers. They, as is well known, also take care of the maintenance of the toilets; here Linus refers to the toilet bowl. The bowl is a porcelain artifact, which makes us sit comfortably; using then a series of pipes and devices, it allows us a correct discharge of what you know down into the sewerage system.

Linus has used this refined metaphor to divide the Git commands into two families, the highest-level ones, comfortable for a user interested in the most common operations (porcelain) and those used internally by the same (but usable at the discretion of the more experienced users) to perform lower-level operations (plumbing).

We can, therefore, consider porcelain commands as interface commands to the user, while the plumbing works at a low level. This also means that porcelain commands stay more stable over time (usage patterns and options vary with more caution and delayed time), as they are used directly, but are also implemented in numerous graphic tools, editors, and so on, while plumbing generally evolves with less restrictions.

There is no precise subdivision between these two categories of commands, as the border is often quite lively; we will still use them, in order to better understand the internal functioning of Git.

Let's go back to the topic now; we were talking about Git objects.

Git uses four different types of objects, and commit is one of these. Then there are tree, blob, and annotated tag. Let's leave the annotated tags aside for a moment (whoever already uses a versioning system knows what tags are) and focus on blobs and trees.

Here, for convenience, there is the output of the git cat-file -p command typed before:

[15] ~/grocery (master)
$ git cat-file -p a57d7
tree a31c31cb8d7cc16eeae1d2c15e61ed7382cebf40
author Ferdinando Santacroce <ferdinando.santacroce@gmail.com> 1502970693 +0200
committer Ferdinando Santacroce <ferdinando.santacroce@gmail.com> 1502970693 +0200

As we can understand now, this plumbing command lets you peek into the Git objects; with the -p option (which means pretty-print here), we ask Git to show an easier way to read what the contents of the object are.

At this point, it's time to learn what a tree is in Git; in fact, in the command output, we can see this line: tree a31c31cb8d7cc16eeae1d2c15e61ed7382cebf40.

What does it mean? Let's see it together.

主站蜘蛛池模板: 舟山市| 盖州市| 朝阳区| 台山市| 师宗县| 沂源县| 霍州市| 右玉县| 新晃| 阿瓦提县| 兴义市| 萝北县| 三河市| 曲麻莱县| 会东县| 宜兴市| 长寿区| 巩留县| 九龙县| 商南县| 新邵县| 大足县| 山阴县| 宁河县| 大连市| 旌德县| 密云县| 久治县| 农安县| 紫金县| 白银市| 滦平县| 芮城县| 枣强县| 通州区| 盐津县| 渝中区| 万盛区| 安徽省| 富民县| 金堂县|