Git/commit

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Git
Revision as of 17:10, 9 March 2015 by Woozle (talk | contribs) (a bit more explanation from the book)
Jump to navigation Jump to search

"Committed" seems to be a per-file flag that indicates whether a staged file is ready for further operations, such as pushing. (There's some ambiguity about whether it makes sense to speak of files being "[un]modified", or whether that only applies to "changes" -- see notes.)

"A commit" is a specific set of project-file revisions that are archived together at a specific time.

When you create a commit with git commit, Git checksums each subdirectory and stores those tree objects in the Git repository. Git then creates a commit object that has the metadata and a pointer to the root project tree so it can re-create that snapshot when needed.

After committing, the repository contains the following objects:

  • one blob for each of your files, containing that file's contents
  • one tree that lists the contents of the directory and specifies which file names are stored as which blobs
  • one commit with the pointer to that root tree and all the commit metadata.

The last two paragraphs were adapted from 3.1 Git Branching - Branches in a Nutshell.