I have a branch called feature which branches off main at commit F, with two commits, A and B.
This was merged with a merge commit, M, and then the merged was reverted with commit R.
I now want to rebase branch feature so it's on the tip of main, with its commits A and B again, (so I can carry on working on it and fix the problem that caused the revert to be needed).
However, when I do git rebase main, git just fast-forwards me to the tip of main, presumably because it sees that A and B are already on main.
How do I force this?
I've tried git rebase --onto main SHA_FOR_F --no-ff but that does the same thing.
Here's the situation:
R - main | M |\ | B - feature | | | A |/ F | and I'd like:
B - feature | A | R - main | M |\ | B | | | A |/ F | I know I could just cherry-pick A and B individually, but is there a way of doing this in one go?
git rebase --onto Xwhile on branch B with commits Y and Z, and suppose that the actual topology is...--X--Y--Z. Then commits Y and Z already exist as two commits immediately following X, sogit rebaseby default re-uses them. Adding-for--no-ff(either one) tells rebase to copy Y and Z anyway. Rebase doesn't say anything about this at the time it does it, though.