1

I have some commits on the same branch like this X1 -> X2 -> X3 -> Y1 -> X4 -> X5

And then after I commit X5, I did reset HEAD to Y1 with

git reset --hard Y1

After that, commits X4 and X5 be lost. It's normal, but I still lost commit X2 and X3. So I did not understand why that is. Could you please help me to explain that? Thank you

1 Answers1

0

If X3 is the parent commit of Y1, you should not have lost it:

A git log should still be able to list X3 ans X2 as ancestors of Y1.

If not, as commented, you can cancel your reset --hard with git reset --hard HEAD@{1}

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250