Lets say I have two branches A
and B
(A)--------(A+B)--------------(A+B+R)
\ / merge \ revert /
\ / \ /
(B)----(B+) (R)----
First, I merged branch B
to A
,
Then I reverted the merge request with GitHub's revert feature.
Now when I fix some code on branch B
and need to merge to A
again, almost all changes (except the new one that I fix) are ignored. How can I get the changes again?
You need to revert the revert, i.e. revert the commit that your previous revert created.
The reason for this is that a merge really does 2 things: it changes the file contents to reflect the merge, and also creates a commit with 2 parents to tell git what was merged. When you revert, it undoes the first thing, but not the second. So when you try to re-do the merge, git has no idea that you reverted the previous merge, so it ignores everything before then.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With