Walk through what `git commit` does at the object level.
IntermediateConceptGit internals: objects, refs and the index
Answer
Git writes the index as tree objects (one per directory, bottom up), creates a commit object referencing the root tree, the current HEAD commit as parent, plus author/committer and message, then updates the branch ref that HEAD points to. Finally the reflog entries for the branch and HEAD are appended.
git cat-file -p HEAD
# tree <id>
# parent <id>
# author ... committer ...
More on Git internals: objects, refs and the index
What are the four object types in Git's object database?BeginnerIs Git a snapshot system or a diff system?BeginnerWhat is the SHA-1 (or SHA-256) hash of an object and how is it computed?BeginnerWhere does Git store objects on disk, and what are loose objects versus packfiles?IntermediateWhat exactly is a branch, and what does creating one cost?IntermediateWhat is HEAD?Beginner