Question: 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 ?

Answer: 
> 
> Since porcelain commands are built with the plumbing commands ...
> 
> 
> 

Unfortunately, this premise isn't quite true ([j6t noted this as well](https://stackoverflow.com/q/65189297/1256452)). 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.](https://git-merge.com/) I'm sure there have been other papers earlier but I have no references.
Today, `git add` and `git commit` are built into `git` and are not scripted. I think that `git add` was never scripted, but `git commit` certainly was. You can find the old implementation in `contrib/examples` of [an old commit of the Git repository](https://github.com/git/git/tree/ae1644b08e85fb64367b273337d8ebcbdabe0685/contrib/examples).

`git commit` was scripted around `git write-tree` and `git commit-tree`. `git add` is basically a glorified version of `git update-index`.