You should write git reset --hard HEAD^2
, which means to access the second parent of the merge commit (which is the one of U2)
See git-revisions
git help revisions
~, e.g. master~3
A suffix ~ to a revision parameter means the commit object that is the <n>
th generation
ancestor of the named commit object, following only the first parents. I.e. <rev>~3
is
equivalent to <rev>^^^
which is equivalent to <rev>^1^1^1
. See below for an illustration of the
usage of this form.
The first parents are, in case of a merge request, the commit that a branch was merged into (here you merged C9 into C1), so C1 is the first parent, and C9 the second parent.
You can access to the nth
parent of a commit with commit^n
So if you do
git reset --hard HEAD^2
it should work
Additional info about the ^
notation :
<rev>
^, e.g. HEAD^, v1.5.1^0
A suffix ^ to a revision parameter means the first parent of that commit object. ^<n>
means
the <n>
th parent (i.e. <rev>
^ is equivalent to <rev>
^1). As a special rule, <rev>
^0 means the
commit itself and is used when <rev>
is the object name of a tag object that refers to a commit
object.