- Git Essentials(Second Edition)
- Ferdinando Santacroce
- 457字
- 2021-07-02 15:27:07
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.
- 我們都是數(shù)據(jù)控:用大數(shù)據(jù)改變商業(yè)、生活和思維方式
- 在你身邊為你設(shè)計(jì)Ⅲ:騰訊服務(wù)設(shè)計(jì)思維與實(shí)戰(zhàn)
- 數(shù)據(jù)挖掘原理與實(shí)踐
- 從零開始學(xué)Hadoop大數(shù)據(jù)分析(視頻教學(xué)版)
- 輕松學(xué)大數(shù)據(jù)挖掘:算法、場景與數(shù)據(jù)產(chǎn)品
- 復(fù)雜性思考:復(fù)雜性科學(xué)和計(jì)算模型(原書第2版)
- 正則表達(dá)式必知必會
- 文本數(shù)據(jù)挖掘:基于R語言
- 數(shù)據(jù)結(jié)構(gòu)與算法(C語言版)
- Creating Dynamic UIs with Android Fragments(Second Edition)
- 3D計(jì)算機(jī)視覺:原理、算法及應(yīng)用
- Hands-On Mathematics for Deep Learning
- Proxmox VE超融合集群實(shí)踐真?zhèn)?/a>
- 高維數(shù)據(jù)分析預(yù)處理技術(shù)
- 大數(shù)據(jù)精準(zhǔn)挖掘