Git commit

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:

Git commit

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".

Note

Do not worry about the blob and tree objects, which are created as a part of the add operation when not committed; these are destroyed as part of the garbage collection process after a few months.

Now if you do a git status you will see that the changes you staged are not in the staged changes state any longer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.172.146