git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] git-merge documentation: describe how conflict is presented
@ 2008-09-01  6:28 Junio C Hamano
  2008-09-01 10:29 ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2008-09-01  6:28 UTC (permalink / raw)
  To: git; +Cc: Linus Torvalds

We took it granted that everybody knows how to read the RCS merge style
conflicts, and did not give illustrations in the documentation.  Now we
are introducing an alternative output style, it is time to document this.

The lack of illustration has been bugging me for a long time.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * It always bothered me that we say "conflicts are shown the same way as
   you would see with CVS or SVN" or "resolve it the same way as you would
   in other SCMs", without explicitly saying how they look like or how you
   would actually resolve them.  Recent update to this manual page by Dan
   Hensgen made the situation better for the latter issue, and this one
   addresses the former one.

 Documentation/git-merge.txt |   65 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 17a15ac..8065d17 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -119,6 +119,71 @@ When there are conflicts, these things happen:
    same and the index entries for them stay as they were,
    i.e. matching `HEAD`.
 
+HOW CONFLICTS ARE PRESENTED
+---------------------------
+
+During a merge, the working tree files are updated to reflect the result
+of the merge.  Among the changes made to the common ancestor's version,
+non-overlapping ones (that is, you changed an area of the file while the
+other side left that area intact, or vice versa) are incorporated in the
+final result verbatim.  When both sides made changes to the same area,
+however, git cannot randomly pick one side over the other, and asks you to
+resolve it by leaving what both sides did to that area.
+
+By default, git uses the same style as that is used by "merge" program
+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.
+<<<<<<< yours:sample.txt
+Conflict resolution is hard;
+let's go shopping.
+=======
+Git makes conflict resolution easy.
+>>>>>>> theirs:sample.txt
+And here is another line that is cleanly resolved or unmodified.
+------------
+
+The area a pair of conflicting changes happened is marked with markers
+"<<<<<<", "=======", and ">>>>>>>".  The part before the "=======" is
+typically your side, and the part after it is typically their side.
+
+The default format does not show what the original said in the conflicted
+area.  You cannot tell how many lines are deleted and replaced with the
+Barbie's remark by your side.  The only thing you can tell is that your
+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:
+
+------------
+Here are lines that are either unchanged from the common
+ancestor, or cleanly resolved because only one side changed.
+<<<<<<< yours:sample.txt
+Conflict resolution is hard;
+let's go shopping.
+|||||||
+Conflict resolution is hard.
+=======
+Git makes conflict resolution easy.
+>>>>>>> theirs:sample.txt
+And here is another line that is cleanly resolved or unmodified.
+------------
+
+In addition to the "<<<<<<", "=======", and ">>>>>>>" markers, it uses
+another "|||||||" marker that is followed by the original text.  You can
+tell that the original just stated a fact, and your side simply gave in to
+that statement and gave up, while the other side tried to have a more
+positive attitude.  You can sometimes come up with a better resolution by
+viewing the original.
+
+
+HOW TO RESOLVE CONFLICTS
+------------------------
+
 After seeing a conflict, you can do two things:
 
  * Decide not to merge.  The only clean-up you need are to reset
-- 
1.6.0.1.260.g7aa8

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

* Re: [PATCH 2/2] git-merge documentation: describe how conflict is presented
  2008-09-01  6:28 [PATCH 2/2] git-merge documentation: describe how conflict is presented Junio C Hamano
@ 2008-09-01 10:29 ` Jakub Narebski
  2008-09-01 10:43   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2008-09-01 10:29 UTC (permalink / raw)
  To: git

Junio C Hamano wrote:

> +By default, git uses the same style as that is used by "merge" program
> +from the RCS suite to present such a conflicted hunk, like this:

Actually it is also one of diff3 output format, to be more exact it is
format generated by "diff3 -E"/"diff3 --show-overlap"
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

* Re: [PATCH 2/2] git-merge documentation: describe how conflict is presented
  2008-09-01 10:29 ` Jakub Narebski
@ 2008-09-01 10:43   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2008-09-01 10:43 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> Junio C Hamano wrote:
>
>> +By default, git uses the same style as that is used by "merge" program
>> +from the RCS suite to present such a conflicted hunk, like this:
>
> Actually it is also one of diff3 output format, to be more exact it is
> format generated by "diff3 -E"/"diff3 --show-overlap"

I took this from "diff3 -m" format, fwiw.

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

end of thread, other threads:[~2008-09-01 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-01  6:28 [PATCH 2/2] git-merge documentation: describe how conflict is presented Junio C Hamano
2008-09-01 10:29 ` Jakub Narebski
2008-09-01 10:43   ` Junio C Hamano

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 NNTP newsgroup(s).