git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Documentation: make 3-way merge warning more generic
@ 2017-04-01 13:31 brian m. carlson
  2017-04-01 19:26 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: brian m. carlson @ 2017-04-01 13:31 UTC (permalink / raw)
  To: git

The documentation for merge strategies noted that if a change was
reverted on only one branch of a merge, the resultant merge would
contain the change.  However, similar surprising behavior can occur
where cherry-picking only one commit from a series to the other branch
can cause conflicts.

Adjust the text to state in the first sentence that only the heads and
the merge base are considered for three-way merge, instead of hiding
this in the second sentence after introducing a scenario which might not
apply to the user.  This makes it easier for users to understand by
first introducing the general rule (which applies to many scenarios),
and only then providing a specific example.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---

I ran into this scenario with a co-worker who is a fairly advanced Git
user.  He created a series of five commits that modified a file on our
development branch and requested the cherry-pick of one of those onto
our maintenance branch.  When we merged the maintenance branch into the
development branch, he was surprised that there were conflicts.  He
expected Git to realize that the commit was already present and ignore
it.

I pointed out the documentation to him, but realized that it didn't
cover this case well, so I decided to reword it such that it covers this
case a little better, as well as addressing the original issue.

Feedback on how I did in that regard would be welcome.

 Documentation/merge-strategies.txt | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt
index 2eb92b9327..54da2ffa33 100644
--- a/Documentation/merge-strategies.txt
+++ b/Documentation/merge-strategies.txt
@@ -123,9 +123,9 @@ subtree::
 	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.
+only the heads and the merge base are considered when performing a merge, not
+the individual commits.  This means that 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.  The merge algorithm
+considers the reverted change as no change at all, and substitutes the changed
+version instead.
-- 
2.12.2.564.g063fe858b8


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Documentation: make 3-way merge warning more generic
  2017-04-01 13:31 [PATCH] Documentation: make 3-way merge warning more generic brian m. carlson
@ 2017-04-01 19:26 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2017-04-01 19:26 UTC (permalink / raw)
  To: brian m. carlson; +Cc: git

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

>  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.
> +only the heads and the merge base are considered when performing a merge, not
> +the individual commits.  This means that 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.  The merge algorithm
> +considers the reverted change as no change at all, and substitutes the changed
> +version instead.

I agree that it makes sense to say 3-way merge considers only three
points upfront.  

I do not think "this means" is helpful to the readers, though.  Drop
"This means that" and instead rewrite the remainder of the paragraph
after "present in the merged result", perhaps?

	If a change is made on both branches but later reverted on
	one of the branches, the net effect the branch that reverted
	the change has to the project is nothing, while the net
	effect of the other branch is to make that change.  The
	3-way merge, i.e. "if one branch did something while the
	other branch didn't do that something, merge result is to do
	that something", rule keeps the change in the merge result.

We do not need to say "some people find this confusing" buried in a
long paragraph, which would not even serve the purpose of attracting
readers' eyes by shouting "THIS MAY BE DIFFICULT, PAY ATTENTION".
The last sentence in the original (and your version) only repeats
the same thing without saying what the real 3-way merge rule is, and
I think a rewrite like the above that makes it more explicit is
easier to understand.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-01 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 13:31 [PATCH] Documentation: make 3-way merge warning more generic brian m. carlson
2017-04-01 19:26 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).