I resolved an issue with the following branches layout:
featureA - branched from develop, a lot of changes across all files. Didn't work on it in a long time.
develop - current release, bug fixes, other new features that needed to be released. Worked on it recently.
I wanted all the new stuff from Develop to be on the featureA.
So I did:
- Merge Develop into featureA -> overwrote everything in featureA
- Merge featureA into copy of develop to test if it changes anything -> same as above
- Then I tried rebasing
On featureA branch:
git rebase develop
(which would move the entire feature branch on top of the develop branch and keep all the commits) -> it didn't. It overwrote everything with develop.
Then:
On develop branch:
git rebase featureA
(this moved entire develop branch on top of the featureA) And that worked!
However, there were conflicts which makes sense because files were edited on both, but that is what I wanted because I could now pick and choose.
error: could not apply fa39187... something to add to patch A
So then I would resolved the conflict (pick the changes I wanted...sometimes picked something from featureA and from develop within the same file) and would commit and push and then continue with the rebasing until the next commit conflict using
git rebase --continue
which would say that there is no longer a problem and that I should instead use
git rebase --skip
Which I do, and then another conflict comes and so on.
So basically trying rebasing other way around allowed me to see all the code changes and one by one solve the conflicts which is what I wanted to do.