When the commit
command is executed, a commit object gets created with the metadata of the content/changes that were added earlier using the git add
command. The metadata includes the following:
Name of the person who authored the change and the relevant date and time along with the time zone settings
Name of the person who committed the change and the relevant date and time along with the time zone settings
Then the created commit object gets linked to the tree object, which has already linked with the blob thus completing the versioning process as shown in the following figure:
Note that the head contains the branch name and not the SHA-1 ID of the commit that it is pointing to. This is because it becomes tough to identify a branch with its commit IDs when the volume and position of commits inside a branch keep changing, hence the statement "branch moves".