Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rebase when it says that current branch is up to date even though it isn't?

Tags:

git

rebase

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.

like image 342
maxhallinan Avatar asked Jul 26 '16 21:07

maxhallinan


1 Answers

In my case --force-rebase helped. I guess, in your case it would be:

git checkout b
git rebase --force-rebase a
like image 91
nobody Avatar answered Nov 10 '22 09:11

nobody