{"thread":{"id":"15125","subject":"0001-Detailed-tools-useful-when-resolving-merge-conflicts.patch","startedAt":"2008-08-21T03:27:32Z","lastAt":"2008-08-21T05:53:27Z","messageCount":2,"participants":["Dan Hensgen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"87938","messageId":"8f6a00e30808202027s1d481a01q22c5a7444cd03f80@mail.gmail.com","threadId":"15125","inReplyTo":null,"subject":"0001-Detailed-tools-useful-when-resolving-merge-conflicts.patch","fromName":"Dan Hensgen","fromEmail":"dan@methodhead.com","sentAt":"2008-08-21T03:27:32Z","receivedAt":"2008-08-21T03:27:32Z","isPatch":false,"sender":{"key":"dan@methodhead.com","avatar":null},"body":"Sorry, had trouble with git send-email.\n\nThanks,\nDan\n\n\nFrom b2ca52f8ba70e689cd8e9424707629e4ca37fab3 Mon Sep 17 00:00:00 2001\nFrom: Dan Hensgen <dan@macbook.danhensgen.com>\nDate: Wed, 20 Aug 2008 23:14:06 -0400\nSubject: [PATCH] Detailed tools useful when resolving merge conflicts\n\nSigned-off-by: Dan Hensgen <dan@methodhead.com>\n---\n Documentation/git-merge.txt |   27 ++++++++++++++++++++-------\n 1 files changed, 20 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt\nindex 17a15ac..bff56c5 100644\n--- a/Documentation/git-merge.txt\n+++ b/Documentation/git-merge.txt\n@@ -126,13 +126,26 @@ After seeing a conflict, you can do two things:\n    up working tree changes made by 2. and 3.; 'git-reset --hard' can\n    be used for this.\n \n- * Resolve the conflicts.  `git diff` would report only the\n-   conflicting paths because of the above 2. and 3.\n-   Edit the working tree files into a desirable shape\n-   ('git mergetool' can ease this task), 'git-add' or 'git-rm'\n-   them, to make the index file contain what the merge result\n-   should be, and run 'git-commit' to commit the result.\n-\n+ * Resolve the conflicts.  Edit the working tree files into shape\n+   and 'git-add' to the index.  'git-commit' to seal the deal.\n+\n+You can work through conflict with a number of tools:\n+\n+ * Look at the originals.  'git show :1:filename' shows the\n+   common ancestor, 'git show :2:filename' shows the HEAD\n+   version and 'git show :3:filename' shows the remote\n+   version.\n+\n+ * Diff the conflicts against the originals.  'git-diff --base'\n+   diffs against the common ancestor, 'git-diff --ours' diffs\n+   against the HEAD version and 'git-diff --theirs' diffs\n+   against the remote version.\n+\n+ * Use a mergetool.  'git diff mergetool' to start the merge\n+   process.  Four versions of a conflicted file get written as\n+   the mergetool starts, BASE, LOCAL, REMOTE and BACKUP.\n+   They're created for the  mergetool, but they're handy\n+   alternatives to the 'git show :1:filename' command.\n \n SEE ALSO\n --------\n-- \n1.5.6.2\n\n"},{"id":"87945","messageId":"7vvdxukj6w.fsf@gitster.siamese.dyndns.org","threadId":"15125","inReplyTo":"8f6a00e30808202027s1d481a01q22c5a7444cd03f80@mail.gmail.com","subject":"Re: 0001-Detailed-tools-useful-when-resolving-merge-conflicts.patch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-21T05:53:27Z","receivedAt":"2008-08-21T05:53:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Dan Hensgen\" <dan@methodhead.com> writes:\n\n> + * Resolve the conflicts.  Edit the working tree files into shape\n> +   and 'git-add' to the index.  'git-commit' to seal the deal.\n\nThe documentation assumed the user have experience with the usual conflict\nmarkers, and a more detailed explanation than what we currently have is\ncertainly welcomed.\n\nI however cannot tell who the intended target audience of your description\nis, from the order of presentation.\n\nIf you primarily target newbies and GUI-minded people, I think mergetool\nshould be the first one.\n\nOn the other hand, for command-line oriented people, you failed to\ndescribe two more common and useful ways.\n\n - \"git diff\" itself will show the diff that contains the conflicted part,\n   in a three-way diff format.  For example, if you try to merge c48544e\n   (gitweb: use new Git::Repo API, and add optional caching, 2008-08-18)\n   into c5a00f7 (Merge branch 'master' into next, 2008-08-20), you would\n   see something like this:\n\n   $ git diff\n   diff --cc t/t9500-gitweb-standalone-no-errors.sh\n   index 46ba19b,7f134f5..0000000\n   --- i/t/t9500-gitweb-standalone-no-errors.sh\n   +++ w/t/t9500-gitweb-standalone-no-errors.sh\n   @@@ -54,7 -54,7 +54,11 @@@ gitweb_run () \n           # written to web server logs, so we are not interested in that:\n           # we are interested only in properly formatted errors/warnings\n           rm -f gitweb.log &&\n   ++<<<<<<< HEAD:t/t9500-gitweb-standalone-no-errors.sh\n    +\tperl -- \"$TEST_DIRECTORY/../gitweb/gitweb.perl\" \\\n   ++=======\n   + \t\"$PERL_PATH\" -- \"$TEST_DIRECTORY/../gitweb/gitweb.perl\" \\\n   ++>>>>>>> lw/gitweb:t/t9500-gitweb-standalone-no-errors.sh\n                   >/dev/null 2>gitweb.log &&\n           if grep -q -s \"^[[]\" gitweb.log >/dev/null; then false; else true; fi\n  \n   which makes it clear that since the common ancestor, our side (HEAD)\n   added the line that begins with \"perl\", while the branch you are\n   merging (lw/gitweb) added the line that begins with \"$PERL_PATH\".  In\n   this case, Lea's change is a pure superset of what our side did, so I'd\n   take the latter half as the resolution.\n\n - \"git log --merge -p --left-right <path>\" will show the commits on your\n   fork and the other branch that touch the paths involved in the merge,\n   with explanations why each change was made.  The first entry of the\n   output is c48544e (gitweb: use new Git::Repo API, and add optional\n   caching, 2008-08-18) that changes \"perl\" to \"$PERL_PATH\" and also\n   introduces \"$TEST_DIRECTORY/\" by replacing what used to be \"$(pwd)\",\n   and you can tell it is from Lea's branch by looking at its \"commit\"\n   line with right-pointing-arrow '>' at the beginning:\n\n   commit >c48544e29a0a9ea2f2b4a601cf4977174b53e803\n   Author: Lea Wiemann <lewiemann@gmail.com>\n   Date:   Mon Aug 18 21:39:49 2008 +0200\n\n   The second entry in the output is bfdbee9 (tests: use $TEST_DIRECTORY\n   to refer to the t/ directory, 2008-08-08) with a left-pointing arrow,\n   which is mine:\n\n   commit <bfdbee98109c5ad2dbbc392e7eed1ae688acc039\n   Author: Junio C Hamano <gitster@pobox.com>\n   Date:   Fri Aug 8 02:26:28 2008 -0700\n\n   that only changes \"$(pwd)\" to \"$TEST_DIRECTORY\".  By looking at these\n   two, you can be sure that taking Lea's change as the superset is the\n   right thing to do.\n\nYou can of course alternatively look at the original, but I do not think\nthat should be taught as the first two suggestions before mergetool, plain\n\"git diff\" or \"git log --merge\".\n"}]}