I read about git objects: blob, tree, commit, tag. To better understand how git works, I tried a low level command like write-tree and commit-tree .
mkdir test; cd test mkdir test; cd test git init- I am creating a file and
git add file . I see the blob and tree object being generated in .git/objects git write-tree to print the current tree idgit commit-tree treeID -m "commit a tree" to commit this tree. After this operation, a commit object is created, and I see that it contains the author, date, etc. However, I cannot check my commits with git log , error: fatal: bad default revision 'HEAD' .
After performing the above operations, when I run git status , I see that the file is still in the index, waiting to be committed. What is the use of commit-tree and what is the difference between commit-tree and `commit '?
source share