I have two parallel projects with two branches A and B.
Each branch was supposed to be developed separately and merged later when the development is complete.
By mistake, I merged branch B twice into branch A prematurely. After the merge, there were more commits made to both branches.
The merge contains some new files that have been created to branch B, and there are also few files that are shared in both branch A and branch B which have been modified by branch B.
What I want to do is, revert the merge that happened in branch A, and then continue the development of branch A and branch B (make more commits to both branches after the revert), and then be able to merge these branches again at a later point.
I did some research here and came up with the following scenario. Can someone more familiar with git advise if this is a good way to go about what I want to achieve?
Let's say the merge commit is: 123
- Run the revert command in branch A
git revert -m 1 123
(commit all deletions into branch A as a result of the revert)
continue the work on branch A and branch B separately.
at a later point, merge these two branches again. I would first create a new branch C based off of A. And then I would revert the original revert in branch C. And then I would merge branch B to branch C.
git checkout -b C
git revert 123
git merge B
Does this sound like the right way to approach this problem?
Any help would be appreciated. Thanks in advance.