]> git.ipfire.org Git - thirdparty/git.git/commitdiff
update documentation for new zdiff3 conflictStyle
authorElijah Newren <newren@gmail.com>
Wed, 1 Dec 2021 00:05:07 +0000 (00:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Dec 2021 22:45:59 +0000 (14:45 -0800)
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/merge.txt
Documentation/git-checkout.txt
Documentation/git-merge-file.txt
Documentation/git-merge.txt
Documentation/git-rebase.txt
Documentation/git-restore.txt
Documentation/git-switch.txt
Documentation/technical/rerere.txt
builtin/checkout.c

index e27cc639447f70b97d911f43dd9e09d11114334a..99e83dd36e53e6079721a5a123fdf6392f4fc2b8 100644 (file)
@@ -4,7 +4,14 @@ merge.conflictStyle::
        shows a `<<<<<<<` conflict marker, changes made by one side,
        a `=======` marker, changes made by the other side, and then
        a `>>>>>>>` marker.  An alternate style, "diff3", adds a `|||||||`
-       marker and the original text before the `=======` marker.
+       marker and the original text before the `=======` marker.  The
+       "merge" style tends to produce smaller conflict regions than diff3,
+       both because of the exclusion of the original text, and because
+       when a subset of lines match on the two sides they are just pulled
+       out of the conflict region.  Another alternate style, "zdiff3", is
+       similar to diff3 but removes matching lines on the two sides from
+       the conflict region when those matching lines appear near either
+       the beginning or end of a conflict region.
 
 merge.defaultToUpstream::
        If merge is called without any commit argument, merge the upstream
index d473c9bf38753ee0786d10e7509a83bde7e58c97..00e62031bedd9b67c4e1657a415b968cd24c939d 100644 (file)
@@ -266,8 +266,7 @@ When switching branches with `--merge`, staged changes may be lost.
        The same as `--merge` option above, but changes the way the
        conflicting hunks are presented, overriding the
        `merge.conflictStyle` configuration variable.  Possible values are
-       "merge" (default) and "diff3" (in addition to what is shown by
-       "merge" style, shows the original contents).
+       "merge" (default), "diff3", and "zdiff3".
 
 -p::
 --patch::
index f85603261325f6f88b31c30b5fb2bafcded58d92..7e9093fab60d267fa795e3d3fddd26cdfacfb557 100644 (file)
@@ -70,6 +70,9 @@ OPTIONS
 --diff3::
        Show conflicts in "diff3" style.
 
+--zdiff3::
+       Show conflicts in "zdiff3" style.
+
 --ours::
 --theirs::
 --union::
index e4f3352eb584539b75235fc304431646df9415f4..e8cecf5a51daaea811541af35fe5955636d9a0a0 100644 (file)
@@ -240,7 +240,8 @@ from the RCS suite to present such a conflicted hunk, like this:
 
 ------------
 Here are lines that are either unchanged from the common
-ancestor, or cleanly resolved because only one side changed.
+ancestor, or cleanly resolved because only one side changed,
+or cleanly resolved because both sides changed the same way.
 <<<<<<< yours:sample.txt
 Conflict resolution is hard;
 let's go shopping.
@@ -261,16 +262,37 @@ side wants to say it is hard and you'd prefer to go shopping, while the
 other side wants to claim it is easy.
 
 An alternative style can be used by setting the "merge.conflictStyle"
-configuration variable to "diff3".  In "diff3" style, the above conflict
-may look like this:
+configuration variable to either "diff3" or "zdiff3".  In "diff3"
+style, the above conflict may look like this:
 
 ------------
 Here are lines that are either unchanged from the common
-ancestor, or cleanly resolved because only one side changed.
+ancestor, or cleanly resolved because only one side changed,
 <<<<<<< yours:sample.txt
+or cleanly resolved because both sides changed the same way.
 Conflict resolution is hard;
 let's go shopping.
-|||||||
+||||||| base:sample.txt
+or cleanly resolved because both sides changed identically.
+Conflict resolution is hard.
+=======
+or cleanly resolved because both sides changed the same way.
+Git makes conflict resolution easy.
+>>>>>>> theirs:sample.txt
+And here is another line that is cleanly resolved or unmodified.
+------------
+
+while in "zdiff3" style, it may look like this:
+
+------------
+Here are lines that are either unchanged from the common
+ancestor, or cleanly resolved because only one side changed,
+or cleanly resolved because both sides changed the same way.
+<<<<<<< yours:sample.txt
+Conflict resolution is hard;
+let's go shopping.
+||||||| base:sample.txt
+or cleanly resolved because both sides changed identically.
 Conflict resolution is hard.
 =======
 Git makes conflict resolution easy.
index a1af21fcefe6098df8506c46e71a91585625281e..9da4647061cdc7e85df685169c81f2f08b9d6707 100644 (file)
@@ -714,9 +714,9 @@ information about the rebased commits and their parents (and instead
 generates new fake commits based off limited information in the
 generated patches), those commits cannot be identified; instead it has
 to fall back to a commit summary.  Also, when merge.conflictStyle is
-set to diff3, the apply backend will use "constructed merge base" to
-label the content from the merge base, and thus provide no information
-about the merge base commit whatsoever.
+set to diff3 or zdiff3, the apply backend will use "constructed merge
+base" to label the content from the merge base, and thus provide no
+information about the merge base commit whatsoever.
 
 The merge backend works with the full commits on both sides of history
 and thus has no such limitations.
index 55bde91ef9e54be6c9ecf928f6f72c775b45809a..5964810caa4153a6628ca312669a77a90b41943a 100644 (file)
@@ -92,8 +92,7 @@ in linkgit:git-checkout[1] for details.
        The same as `--merge` option above, but changes the way the
        conflicting hunks are presented, overriding the
        `merge.conflictStyle` configuration variable.  Possible values
-       are "merge" (default) and "diff3" (in addition to what is
-       shown by "merge" style, shows the original contents).
+       are "merge" (default), "diff3", and "zdiff3".
 
 --ignore-unmerged::
        When restoring files on the working tree from the index, do
index 5c438cd505875841763f0151dfe0a2c1454dfcc5..5c90f76fbe3511054b4261a2286e2d7518532e2d 100644 (file)
@@ -137,8 +137,7 @@ should result in deletion of the path).
        The same as `--merge` option above, but changes the way the
        conflicting hunks are presented, overriding the
        `merge.conflictStyle` configuration variable.  Possible values are
-       "merge" (default) and "diff3" (in addition to what is shown by
-       "merge" style, shows the original contents).
+       "merge" (default), "diff3", and "zdiff3".
 
 -q::
 --quiet::
index af5f9fc24f9343e73aca771d310570251fe2b922..35d454143399e0593af41029d75e9ff4fd3d432e 100644 (file)
@@ -14,9 +14,9 @@ conflicts before writing them to the rerere database.
 
 Different conflict styles and branch names are normalized by stripping
 the labels from the conflict markers, and removing the common ancestor
-version from the `diff3` conflict style. Branches that are merged
-in different order are normalized by sorting the conflict hunks.  More
-on each of those steps in the following sections.
+version from the `diff3` or `zdiff3` conflict styles.  Branches that
+are merged in different order are normalized by sorting the conflict
+hunks.  More on each of those steps in the following sections.
 
 Once these two normalization operations are applied, a conflict ID is
 calculated based on the normalized conflict, which is later used by
@@ -42,8 +42,8 @@ get a conflict like the following:
     >>>>>>> AC
 
 Doing the analogous with AC2 (forking a branch ABAC2 off of branch AB
-and then merging branch AC2 into it), using the diff3 conflict style,
-we get a conflict like the following:
+and then merging branch AC2 into it), using the diff3 or zdiff3
+conflict style, we get a conflict like the following:
 
     <<<<<<< HEAD
     B
index cbf73b8c9f65ae2fdd1d96265bd4972aeaa9bd68..26ea1c0bdbbeab6ac23c842b35f626de8f3161b2 100644 (file)
@@ -1517,7 +1517,7 @@ static struct option *add_common_options(struct checkout_opts *opts,
                OPT_BOOL(0, "progress", &opts->show_progress, N_("force progress reporting")),
                OPT_BOOL('m', "merge", &opts->merge, N_("perform a 3-way merge with the new branch")),
                OPT_STRING(0, "conflict", &opts->conflict_style, N_("style"),
-                          N_("conflict style (merge or diff3)")),
+                          N_("conflict style (merge, diff3, or zdiff3)")),
                OPT_END()
        };
        struct option *newopts = parse_options_concat(prevopts, options);