srgb srgb - 5 months ago 76
Git Question

git revert - git asking parent1 or parent2

I'm trying to revert the latest commit done on the branch (by someone else). I'm using TortoiseGit client. When I click "Revert changes by this commit", git offers two choices:

. What does this mean? What is Parent1 and what is Parent2?



Every commit in git has at least one parent (except for the first/initial commit). A commit's parent is the previous one.

C1 <- C2 <- C3

C1 is the initial commit. C2 is the second one. C1 is the parent of C2. The same goes to C3.

A merge commit is a special commit in the sense of the number of parents.

C1 <- C2 <- C3


.. C4 <- C5 <- C6

C6 is a merge commit. It has two parents, C3 and C5. If you merged the two branches (commits) when you were at C5: C5 is said to be Parent 1 (first parent) and C3 is Parent 2 (second parent).