I have a local ref that contains a few branches that I recently performed git rebase
on:
A---B---C---D master
\
E---F---G topic1
\
H---I---J topic2
Which turned it into:
A---B---C---D master
\
E'---F'---G' topic1
\
H'---I'---J' topic2
by using the following set of commands:
git checkout topic1
git rebase master
git checkout topic2
git rebase topic1
The problem?
I accidentally forgot to do git rebase --no-ff
in order to keep track of all of my previously merged branches. Now, I have no way of easily telling (by using gitk --all
) where my merges occurred. I know that they happened somewhere between HEAD@{E}
and HEAD@{J}
, but without going through each commit individually, I'm lost.
What I have decided to do:
So, I figured that I would use git reflog
as suggested here, along with git reset --hard HEAD@{#}
to revert back to the original state before the two rebases occurred and then attempt to git rebase branchname --no-ff
as I suggested.
My ultimate question is this (with a few additional):
Can I simply go all the way back to the last commit before the first rebase
or do I need to rollback each of the rebases individually? Will each of the top branches be exactly as I used to have them (showing the non-fast forwarded merges that I'm looking for)? Am I making this too difficult/is there a simpler way to do this? Anything I'm neglecting to think about?
Thanks.