Skip to content

Commit

Permalink
Documentation: document pitfalls with 3-way merge
Browse files Browse the repository at this point in the history
Oftentimes people will make the same change in two branches, revert the change
in one branch, and then be surprised when a merge reinstitutes that change when
the branches are merged.  Add an explanatory paragraph that explains that this
occurs and the reason why, so people are not surprised.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
brian m. carlson authored and Junio C Hamano committed Dec 9, 2013
1 parent 2f93541 commit c566500
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Documentation/merge-strategies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,11 @@ subtree::
match the tree structure of A, instead of reading the trees at
the same level. This adjustment is also done to the common
ancestor tree.

With the strategies that use 3-way merge (including the default, 'recursive'),
if a change is made on both branches, but later reverted on one of the
branches, that change will be present in the merged result; some people find
this behavior confusing. It occurs because only the heads and the merge base
are considered when performing a merge, not the individual commits. The merge
algorithm therefore considers the reverted change as no change at all, and
substitutes the changed version instead.

0 comments on commit c566500

Please sign in to comment.