10/14/2021 0 Comments Good Diff Merge Tool For Mac Vs Git
This could be because the person who made the original commit F2 found an improvement (cherries are on sale right now), or maybe they made a larger change that happened to require switching from berries to cherries.Whatever the reason, the commit graph now looks like this: appleThis time, when it’s time to merge the feature branch back into the master branch, there is a merge conflict. AppleIt is also relatively uncommon in an active code base.Consider this alternate timeline: After the cherry-pick, additional commits M3 to the master branch and F3 to the feature branch are made, but this time commit F3 changes the line in question to cherry. Neither of these commits affected the line in question, so the line is still the word berry.It’s time to merge back, and since the line in question is the same in both branches, the merge is trivial, and the result in the final merged result is berry. You then make some commit F2 in the feature branch that changes the line in question from apple to berry, and you cherry-pick commit F2 into the master branch as M2.Time passes, more commits occur, and your commit graph looks like this: appleYou made another commit M3 to the master branch and another commit F3 to the feature branch. These changes don’t affect the line in question, so it still says apple.From the victim branch we create our feature branch from commit V1, and then the story is the same: To the feature branch, we add the same commit F1 from before, which doesn’t affect the line in question, so it continues to be apple. We create a branch based on commit A, ominously named victim, and add a commit called V1, which doesn’t affect the line in question, so it still is apple. But consider this three-branch scenario: appleStart with a commit A, where the line in question is apple. We’ve been using dotted lines in our diagrams to emphasize that the cherry-pick relationship is all in our heads, and not actually recorded anywhere in the commit graph.You have to hope that whoever resolves this merge conflict remembers the history of this line, or can access the team’s knowledge of this line of code to understand that the correct resolution it to accept the changes in the feature branch rather than the one in the master branch.In this case, there haven’t been many changes, and there are only two branches involved, and hopefully there aren’t too many other conflicts in the merge (so that the person resolving the merge hasn’t gotten tired and burnt out), so the chance of a correct resolution are pretty good. > featureThe conflict occurred because the cherry-picked changes were subsequently changed again by one of the branches.
Good Diff Merge Tool Vs Git Update The LineThe poor person stuck with this merge conflict has no idea of the deal with the devil struck by the feature and master branches behind his back. It commits changes V2 and V3 which have nothing to do with the line in question, so the line is still apple.Eventually, the feature branch merges its changes back into the victim branch, producing commit V4, where the line in question is now cherry, thanks to the changes that were made in the feature branch.The time bomb has now moved into the victim branch.The victim branch decides to take a merge from the master branch, and that is where the conflict is detected, because this is the first time the original change F2 encounters its cherry-picked doppelgänger M2. The feature branch makes another change F3 which happens to update the line in question from berry to cherry, while the master branch adds a commit M3 that doesn’t change the line in question, so it remains berry.All through this, the victim branch is blithely unaware of the cherry-picking disaster being created by the feature and master branches.This means that the person trying to resolve the merge was never part of the cherry-pick madness and may not know who to talk to in order to figure out what happened.Okay, that was a long story, and you probably knew most of it already, but believe it or not, as bad as this is, it could get even worse: The explosion might not happen.Wait, why is it worse that an explosion doesn’t happen? We’ll pick this up next time. It is at the time somebody tries to merge the two commits together that the explosion occurs, and that point could be in a faraway place not immediately related to the branches involved in the cherry-pick. If either branch modifies any line touched by the cherry-pick, then that creates a powderkeg that can sit quietly indefinitely. Any lines of code affected by that commit must remain untouched in both branches until the two copies of the commit finally merge.![]() ![]() ![]()
0 Comments
Leave a Reply. |
AuthorAminah ArchivesCategories |