Git Internals Creating new Commits


Example

The git commit command does a few things:

  1. Create blobs and trees to represent your project directory - stored in .git/objects
  2. Creates a new commit object with your author information, commit message, and the root tree from step 1 - also stored in .git/objects
  3. Updates the HEAD ref in .git/HEAD to the hash of the newly-created commit

This results in a new snapshot of your project being added to git that is connected to the previous state.