I have this scenario: There are 2 branches, 'develop' and 'feature-branch'. This two branches have been growing over time each one independently. Now, 16 of November of last year, a merge was done from 'feature-branch' to 'develop'. This merge should not have been done so it was reverted on 19 of November. The problem: now the files in develop are newer, so when doing a merge from 'develop' to the branch to integrate both, git keeps the files in develop. This is a problem because there is code on the branch which is necessary, and since it doesn't create conflicts, I'm not able to integrate them. I would need to manually check every file and check the logic, which is not ideal. Is there any way of fixing this?
git checkout -b prepare-develop-for-merge-into-feature-branch <commit-id-of-merge-revert>
git revert HEAD
git checkout feature-branch
git merge prepare-develop-for-merge-into-feature-branch
git merge develop
The result should then look like what you'd expect it to look if that merge-revert never happened.
Note: There are other approaches to solving this (e.g. reverting the merge-revert direclty on top of feature-branch). However, I've chosen this approach, because it should cause git blame
to still point at the original commits (instead of the revert-revert) while also keeping possible merge-conflicts to a minimum.