A version-control commit records an identifiable revision together with history metadata. In Git, a commit names a tree snapshot and parent commits, alongside author/committer information and a message. An initial commit has no parent; an ordinary commit has one, while a merge can have several.[ref]
The parent links form a commit graph, allowing a tool to compare revisions and traverse ancestry. Rewriting a commit's recorded content or metadata creates a different commit object rather than silently modifying the old one. A commit identifies the recorded source snapshot; reproducing a calculation also requires external data, selected dependencies and execution settings that were not necessarily stored in that snapshot.
A version-control snapshot records the logical state of tracked files at a revision. In Git, tree objects describe directory entries and refer to content objects; a version-control commit identifies the root tree alongside history metadata. Unchanged content can be shared among many version-control snapshots.[ref]
If a repository contains a.txt and b.txt, changing only a.txt creates a new logical version-control snapshot containing the new a.txt and unchanged b.txt. It does not require a second physical copy of every byte. Two version-control commits can identify the same version-control snapshot but have different parents or messages. The recorded files and the ancestry explaining how they arose are therefore distinct information.
A commit graph represents version-control commits as vertices and their parent relationships as directed edges. In Git, taking an edge from a child to each parent gives a directed acyclic graph: an existing version-control commit has fixed parents, and a newly created child cannot become its own ancestor.[ref]
For example, if and both descend directly from , and merge records parents , its edges are , , and . The merge retains both lines of ancestry. A version-control branch labels a selected tip; deleting that label does not by itself remove every reachable vertex. This graph supports ancestry tests and finding common bases for version-control merging.

Articles by others on the same topic (0)

There are currently no matching articles.