I rebased my branch which had the effect of putting some commits on top of my own. Then realized I had forgotten to squash some commits, so hard reset and squashed. Now I need to bring those commits back. But rebasing again tells me that the current branch is up to date, even though it isn't. Is there a way to fix this?
Edit:
There are two branches: a and b. Both are branched from master. Both are up to date with master. Branch a has some changes. I want branch b to have those changes too. I rebased branch a on to b. The latest commit was from branch a. I meant to squash the three commits before that commit. I hard reset to before the latest commit. Then I squashed. Now I want to get back that latest commit in a way that won't cause headaches when the time comes to merge branch b to master.
I've tried reflog
and git reset --hard HEAD@{n}
but same problem: Current branch is up to date.
In my case --force-rebase
helped. I guess, in your case it would be:
git checkout b
git rebase --force-rebase a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With