For example, I have the following file:
// first part function() { var timer = 1; } // second part function() { var timer = 2; } // third part function() { var timer = 3; }
Now two different branches change it. I have a change:
in branch 1:
// first part function() { var timer = "changed in branch1"; } // second part function() { var timer = 2; } // third part function() { var timer = 3; }
in branch2:
// first part function() { var timer = 1; } // second part function() { var timer = "changed in branch2"; } // third part function() { var timer = 3; }
With tripartite merging, these changes will merge into purity because each branch has changed a piece of code that is different from the other. However, when combining, I want the following:
// first part function() { <<<<<<< branch1 var timer = "changed in branch1"; ======= var timer = 1; >>>>>>> branch2 } // second part function() { <<<<<<< branch1 var timer = 2; ======= var timer = "changed in branch2"; >>>>>>> branch2 } // third part function() { var timer = 3; }
Is there any way to achieve such a merge in git? I believe that based on the comments, this kind of merge would be something like this:
- make diff file
- paste the pieces into the final version not in diff
- mark fragments that differ in conflict markers.
source share