Writing a tree object to the database
Now, we have manually created objects in the Git database, but as nothing point to these objects, we have to remember them by their SHA-1 identifier. Furthermore, only the content of the files is stored in the database, so we learn to create a tree object that will refer to the blobs created.
Getting ready
We'll use the same repository of the last examples with the objects we created in the database.
How to do it...
We'll start by adding the first version of mytest.txt
as follows:
$ git update-index --add --cacheinfo 100644 \ 926e8ffd3258ed6edd1e254438f02fd24e417acc mytest.txt
Now we can write the content of the staging area to the database:
$ git write-tree 4c4493f8029d491d280695e263e24772ab6962ce
We can update ...
Get Git: Mastering Version Control now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.