parent commit
The commit that came immediately before another one, recorded by ID inside it.
In more detail
An ordinary commit has one parent, a merge commit has two, and the very first commit has none. Because each commit names its parent by ID, changing an old commit changes every commit after it. HEAD~1 means the first parent of HEAD.
Related terms
- commit — A saved snapshot of the whole project in Git, together with its author, committer, time, message and a pointer to the commit before it.
- root commit — A commit with no parent, normally the very first commit in a repository.
- merge commit — A commit with two (or more) parents, recording the point where two lines of history were joined.
- ancestry reference — A way of naming a commit by counting back from another: a tilde and a number walk back that many first parents, and a caret picks which parent.
Taught in
- What A Commit Really Is — Advanced Git Internals & Distributed Workflows
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows
- Merging: Fast Forward Or A Merge Commit — Advanced Git Internals & Distributed Workflows
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows