Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What plumbing commands are used in porcelain commands add and commit?

Tags:

git

Since porcelain commands are built with the plumbing commands, I am interested to know how the add and commit are built.

For instance, the add command certainly use the hash-object command but I think it uses other commands as well (maybe the update-index). Can someone point me to a resource that explains this in details ?

like image 305
LivBanana Avatar asked Oct 27 '25 20:10

LivBanana


1 Answers

Since porcelain commands are built with the plumbing commands ...

Unfortunately, this premise isn't quite true (j6t noted this as well). I would argue that it should be true, but for various reasons, it isn't. In particular git log does things for which no plumbing command is available, and git status does as well, but git status itself can become a plumbing command via the --porcelain flag.

For instance, the add command certainly use the hash-object command but I think it uses other commands as well (maybe the update-index). Can someone point me to a resource that explains this in details ?

You're correct that a typical git add uses the internal equivalent of git hash-object -w followed by git update-index. However, git add has, for instance, the -p or --patch mode, which is currently a Perl script, and is in the process of being rewritten as C code.

Can someone point me to a resource that explains this in details ?

The only guaranteed-to-be-accurate place to find this information is in the Git source itself. Fortunately that's freely available: just clone the Git repository for Git. Note that the answer to any detailed question is likely to depend on the specific Git version.

[from a comment: are] there conferences, papers etc. that talk about the evolution of Git historically?

There appears to have been a fairly large conference in March 2020. I'm sure there have been other papers earlier but I have no references.

like image 174
torek Avatar answered Oct 29 '25 10:10

torek