This is a bit more complicated than previous threads I have found. Say I have a branch with a bunch of commits. At some point, I realized that I don't want some buried commits (which were caused by a misguided merge). So the history is something like this:
e48ca7de8t
a263f02809 --> unwanted commit
59d785a8e2 --> unwanted commit
2045cc737a
59c2a4127c
f9daf617sj
5f59c2a412
HEAD
Basically I would like to get rid of the two unwanted commits. Is this something that is possible to do?
I suppose I could keep doing git reset HEAD~
over and over again until I reach what the ones I don't want, stash the changes remained and do a git reset --hard
to whichever last one I want. But I wonder if there is a cleaner and safer way of doing this.
Thanks!