{"thread":{"id":"53898","subject":"Improving merge of tricky conflicts","startedAt":"2020-07-21T23:29:55Z","lastAt":"2021-01-21T21:11:24Z","messageCount":25,"participants":["B. Stebler","Johannes Sixt","Jeff King","Junio C Hamano","Sergey Organov","Bono Stebler","Jacob Keller","Martin von Zweigbergk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"401834","messageId":"a0418859-c62e-c207-a1b0-1b1aaf178527@gmail.com","threadId":"53898","inReplyTo":null,"subject":"Improving merge of tricky conflicts","fromName":"B. Stebler","fromEmail":"bono.stebler@gmail.com","sentAt":"2020-07-21T23:29:51Z","receivedAt":"2020-07-21T23:29:55Z","isPatch":false,"sender":{"key":"bono.stebler@gmail.com","avatar":null},"body":"Hi,\n\nI have been looking for a tool to display merge conflicts, that instead \nof showing the two versions of the conflicting section, would show the \ndiff for that section in both conflicting commits.\n\nThe situation that would benefit a lot from this is when one branch has \nmodified a large section of code (e.g. change in indentation), while the \nother branch has only a small change. In that case git will display the \nentire modified section twice, making it very hard to spot the difference.\n\nBeing able to see both commits diff would immediately make it clear how \nto apply the small change into the branch with the large edit.\n\nI've looked around but couldn't find anything, but I'm pretty sure \nsolutions exists. Anyone knows of an existing tool / script that does this?\n\nThank you,\nB. Stebler\n\n"},{"id":"401839","messageId":"4df975f0-e4b1-afa1-cac1-f38e6d31a0d8@kdbg.org","threadId":"53898","inReplyTo":"a0418859-c62e-c207-a1b0-1b1aaf178527@gmail.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2020-07-22T05:50:08Z","receivedAt":"2020-07-22T05:50:12Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 22.07.20 um 01:29 schrieb B. Stebler:\n> I have been looking for a tool to display merge conflicts, that instead\n> of showing the two versions of the conflicting section, would show the\n> diff for that section in both conflicting commits.\n\nPerhaps you want to configure `merge.conflictStyle=diff3`? It does not\nexactly show a diff, but it writes the base version of the conflicted\npart in addition to \"ours\" and \"theirs\".\n\n-- Hannes\n"},{"id":"401843","messageId":"20200722074530.GB3306468@coredump.intra.peff.net","threadId":"53898","inReplyTo":"4df975f0-e4b1-afa1-cac1-f38e6d31a0d8@kdbg.org","subject":"Re: Improving merge of tricky conflicts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-07-22T07:45:30Z","receivedAt":"2020-07-22T07:45:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 22, 2020 at 07:50:08AM +0200, Johannes Sixt wrote:\n\n> Am 22.07.20 um 01:29 schrieb B. Stebler:\n> > I have been looking for a tool to display merge conflicts, that instead\n> > of showing the two versions of the conflicting section, would show the\n> > diff for that section in both conflicting commits.\n> \n> Perhaps you want to configure `merge.conflictStyle=diff3`? It does not\n> exactly show a diff, but it writes the base version of the conflicted\n> part in addition to \"ours\" and \"theirs\".\n\nYeah, I find diff3 is usually sufficient. But the contents of the base,\n\"ours\", and \"theirs\" sides are also available in the index:\n\n  # diff between base (stage 1) and ours (stage 2)\n  git diff :1:file :2:file\n\n  # diff between base (stage 1) and theirs (stage 3)\n  git diff :1:file :3:file\n\nI thought we had added nice aliases for \"ours\" and \"theirs\" instead of\nthe hard-to-remember stage numbers, but I think we only did so for\nthings like \"git checkout --ours\", etc.\n\nThe big downside here, of course, is that it's showing the diff for the\nwhole file, not just one hunk (on the other hand, I often find the\ntrickiest conflicts are ones where the changes unexpectedly span\nmultiple hunks).\n\nThere's also git-mergetool, which uses the information in those stages\nto feed content to other tools, which may show conflicts in more\nadvanced ways. I don't have opinions on any of the particular tools it\nsupports, but \"git mergetool --tool-help\" might be a good place to start\nexploring.\n\n-Peff\n"},{"id":"401848","messageId":"xmqqmu3r5umr.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"20200722074530.GB3306468@coredump.intra.peff.net","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-22T17:26:04Z","receivedAt":"2020-07-22T17:26:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, Jul 22, 2020 at 07:50:08AM +0200, Johannes Sixt wrote:\n>\n>> Am 22.07.20 um 01:29 schrieb B. Stebler:\n>> > I have been looking for a tool to display merge conflicts, that instead\n>> > of showing the two versions of the conflicting section, would show the\n>> > diff for that section in both conflicting commits.\n>> \n>> Perhaps you want to configure `merge.conflictStyle=diff3`? It does not\n>> exactly show a diff, but it writes the base version of the conflicted\n>> part in addition to \"ours\" and \"theirs\".\n>\n> Yeah, I find diff3 is usually sufficient. But the contents of the base,\n> \"ours\", and \"theirs\" sides are also available in the index:\n>\n>   # diff between base (stage 1) and ours (stage 2)\n>   git diff :1:file :2:file\n>\n>   # diff between base (stage 1) and theirs (stage 3)\n>   git diff :1:file :3:file\n>\n> I thought we had added nice aliases for \"ours\" and \"theirs\" instead of\n> the hard-to-remember stage numbers, but I think we only did so for\n> things like \"git checkout --ours\", etc.\n>\n> The big downside here, of course, is that it's showing the diff for the\n> whole file, not just one hunk (on the other hand, I often find the\n> trickiest conflicts are ones where the changes unexpectedly span\n> multiple hunks).\n\nYup, I often find myself comparing the base part (lines between |||\nand ===) with our part (lines between <<< and |||) and their part\n(lines between === and >>>) while looking at the diff3 output to see\nwhat unique change each side did, in order to come up with a\nconflict resolution.\n\nI do this often enough to wonder if I should write a small \"filter\"\nthat I can pipe a whole \"diff3\" <<< ... ||| ... === ... >>> region\nto and convert it into to diffs, but not often enough to motivate\nme to actually write one ;-).\n"},{"id":"401856","messageId":"874kpzmhis.fsf@osv.gnss.ru","threadId":"53898","inReplyTo":"4df975f0-e4b1-afa1-cac1-f38e6d31a0d8@kdbg.org","subject":"Re: Improving merge of tricky conflicts","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-07-22T20:17:15Z","receivedAt":"2020-07-22T20:17:21Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Am 22.07.20 um 01:29 schrieb B. Stebler:\n>> I have been looking for a tool to display merge conflicts, that instead\n>> of showing the two versions of the conflicting section, would show the\n>> diff for that section in both conflicting commits.\n>\n> Perhaps you want to configure `merge.conflictStyle=diff3`?\n\nIs there 'git merge' command-line option for that? I failed to find one.\n\nThanks,\n-- Sergey\n"},{"id":"401862","messageId":"xmqqwo2v45hq.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"874kpzmhis.fsf@osv.gnss.ru","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-22T21:14:25Z","receivedAt":"2020-07-22T21:14:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Johannes Sixt <j6t@kdbg.org> writes:\n>\n>> Am 22.07.20 um 01:29 schrieb B. Stebler:\n>>> I have been looking for a tool to display merge conflicts, that instead\n>>> of showing the two versions of the conflicting section, would show the\n>>> diff for that section in both conflicting commits.\n>>\n>> Perhaps you want to configure `merge.conflictStyle=diff3`?\n>\n> Is there 'git merge' command-line option for that? I failed to find one.\n\nThere isn't, unless you count\n\n    $ git -c merge.conflictstyle=diff3 merge side-branch\n\nas a \"command line option\" (which may technically is).\n"},{"id":"401865","messageId":"87tuxzl00h.fsf@osv.gnss.ru","threadId":"53898","inReplyTo":"xmqqwo2v45hq.fsf@gitster.c.googlers.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-07-22T21:20:46Z","receivedAt":"2020-07-22T21:20:53Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>> Johannes Sixt <j6t@kdbg.org> writes:\n>>\n>>> Am 22.07.20 um 01:29 schrieb B. Stebler:\n>>>> I have been looking for a tool to display merge conflicts, that instead\n>>>> of showing the two versions of the conflicting section, would show the\n>>>> diff for that section in both conflicting commits.\n>>>\n>>> Perhaps you want to configure `merge.conflictStyle=diff3`?\n>>\n>> Is there 'git merge' command-line option for that? I failed to find one.\n>\n> There isn't, unless you count\n>\n>     $ git -c merge.conflictstyle=diff3 merge side-branch\n>\n> as a \"command line option\" (which may technically is).\n\nYeah, I thought of maybe making an alias for that, so apparently I do\ncount it as command line option, thanks!\n\n-- Sergey\n"},{"id":"401869","messageId":"7c3cf4f4-c8aa-66d6-ae6f-88271e21d5ae@gmail.com","threadId":"53898","inReplyTo":"4df975f0-e4b1-afa1-cac1-f38e6d31a0d8@kdbg.org","subject":"Re: Improving merge of tricky conflicts","fromName":"Bono Stebler","fromEmail":"bono.stebler@gmail.com","sentAt":"2020-07-22T22:48:33Z","receivedAt":"2020-07-22T22:48:39Z","isPatch":false,"sender":{"key":"bono.stebler@gmail.com","avatar":null},"body":"Thank you for your reply, and everyone else in the thread. I've played \nwith diff3 and while it is slightly better in some cases, I feel there \nis a much better solution. To illustrate:\n\nCommit 1: https://i.snipboard.io/Ssm7M9.jpg\nCommit 2: https://i.snipboard.io/l2pqdT.jpg\nDiff3: https://i.snipboard.io/teb1RS.jpg\n\nWhat I would actually want: https://i.snipboard.io/8dOHgV.jpg\n\nAfter looking at it and some research, I've managed to mostly automate \nit. You need to manually set the filename, which isn't as convenient as \nhaving the details directly in the file, but it beats rummaging in \ncommits manually by a lot:\n\n# Patch failed at 0001 smol commit\n\nFILENAME=\"conflicting.txt\"\n\nTHEIRS=$(head -1 .git/rebase-apply/0001 | awk '{ print $2 }')\n\nOURS=$(git rev-parse HEAD)\n\nTHEIRS_DIFF=$(git -c color.ui=always show -U0 $THEIRS $FILENAME | tail \n-n +12)\n\nOURS_DIFF=$(git -c color.ui=always show -U0 $OURS $FILENAME | tail -n +12)\n\nprintf \"<<<<<<<<\\n$OURS_DIFF\\n========\\n$THEIRS_DIFF\\n>>>>>>>>\\n\"\n\nVoilà, feel free to use that or suggest improvements, I am by no means a \nbash or git wizard!\n\nCheers,\nB\n\nOn 22/07/2020 07:50, Johannes Sixt wrote:\n> Am 22.07.20 um 01:29 schrieb B. Stebler:\n>> I have been looking for a tool to display merge conflicts, that instead\n>> of showing the two versions of the conflicting section, would show the\n>> diff for that section in both conflicting commits.\n> Perhaps you want to configure `merge.conflictStyle=diff3`? It does not\n> exactly show a diff, but it writes the base version of the conflicted\n> part in addition to \"ours\" and \"theirs\".\n>\n> -- Hannes\n"},{"id":"401951","messageId":"20200723182549.GB3975154@coredump.intra.peff.net","threadId":"53898","inReplyTo":"xmqqmu3r5umr.fsf@gitster.c.googlers.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-07-23T18:25:49Z","receivedAt":"2020-07-23T18:25:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 22, 2020 at 10:26:04AM -0700, Junio C Hamano wrote:\n\n> > The big downside here, of course, is that it's showing the diff for the\n> > whole file, not just one hunk (on the other hand, I often find the\n> > trickiest conflicts are ones where the changes unexpectedly span\n> > multiple hunks).\n> \n> Yup, I often find myself comparing the base part (lines between |||\n> and ===) with our part (lines between <<< and |||) and their part\n> (lines between === and >>>) while looking at the diff3 output to see\n> what unique change each side did, in order to come up with a\n> conflict resolution.\n> \n> I do this often enough to wonder if I should write a small \"filter\"\n> that I can pipe a whole \"diff3\" <<< ... ||| ... === ... >>> region\n> to and convert it into to diffs, but not often enough to motivate\n> me to actually write one ;-).\n\nI would definitely have found that useful before (usually when one side\nmade a tiny one-line change and the other side deleted or drastically\nchanged a huge chunk).\n\nIt might even be possible to stuff it into xdiff's fill_conflict_hunk().\nWe have all of the data there, and xdiff in theory can make diffs. :) It\nmight be easier to prototype it as an external filter, though.\n\nSomething like the script below seems to work; you can run whole files\nthrough it, or do something like \":10,20r!perl foo.pl\" in vim to filter\na snippet. I won't be at all surprised if somebody more familiar with\nvim tells me that you can already do something way better than this\n(I've always found vimdiff pretty confusing).\n\n-- >8 --\n#!/usr/bin/perl\n\nuse File::Temp;\nuse strict;\n\nmy (@base, @ours, @theirs);\nmy $state;\n\nsub flush {\n  print @ours;\n  print \"|||||||\\n\";\n  show_diff(base => \\@base, ours => \\@ours);\n  print \"|||||||\\n\";\n  show_diff(base => \\@base, theirs => \\@theirs);\n  print \"=======\\n\";\n  print @theirs;\n  @ours = @base = @theirs = ();\n}\n\nsub show_diff {\n  my ($pre_name, $pre_data, $post_name, $post_data) = @_;\n\n  my $pre = File::Temp->new;\n  print $pre @$pre_data;\n  $pre->flush;\n\n  my $post = File::Temp->new;\n  print $post @$post_data;\n  $post->flush;\n\n  open(my $diff, '-|', qw(diff -u), $pre->filename, $post->filename);\n  # throw away file header, which just mentions tempfiles, and replace\n  # it with our own\n  <$diff>; <$diff>;\n  print \"--- $pre_name\\n\";\n  print \"+++ $post_name\\n\";\n  while (<$diff>) {\n    print;\n  }\n}\n\nsub state_none {\n  if (/^<{7}/) { $state = \\&state_ours }\n  print\n}\n\nsub state_ours {\n  if (/^\\|{7}/) { $state = \\&state_base }\n  else { push @ours, $_ }\n}\n\nsub state_base {\n  if (/^={7}/) { $state = \\&state_theirs }\n  else { push @base, $_ }\n}\n\nsub state_theirs {\n  if (/^>{7}/) { flush(); print; $state = \\&state_none }\n  else { push @theirs, $_ }\n}\n\n$state = \\&state_none;\nwhile (<>) {\n  $state->();\n}\n"},{"id":"401952","messageId":"20200723182648.GC3975154@coredump.intra.peff.net","threadId":"53898","inReplyTo":"87tuxzl00h.fsf@osv.gnss.ru","subject":"Re: Improving merge of tricky conflicts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-07-23T18:26:48Z","receivedAt":"2020-07-23T18:26:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 23, 2020 at 12:20:46AM +0300, Sergey Organov wrote:\n\n> >> Is there 'git merge' command-line option for that? I failed to find one.\n> >\n> > There isn't, unless you count\n> >\n> >     $ git -c merge.conflictstyle=diff3 merge side-branch\n> >\n> > as a \"command line option\" (which may technically is).\n> \n> Yeah, I thought of maybe making an alias for that, so apparently I do\n> count it as command line option, thanks!\n\nYou can also do it after \"git merge\" aborts with conflicts by running:\n\n  git checkout --conflict=diff3 my-file\n\nbut do note that it will check out from the index, overwriting any\nresolution you've already done in that file.\n\n-Peff\n"},{"id":"401954","messageId":"87blk6yrlc.fsf@osv.gnss.ru","threadId":"53898","inReplyTo":"20200723182648.GC3975154@coredump.intra.peff.net","subject":"Re: Improving merge of tricky conflicts","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-07-23T19:11:11Z","receivedAt":"2020-07-23T19:11:18Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, Jul 23, 2020 at 12:20:46AM +0300, Sergey Organov wrote:\n>\n>> >> Is there 'git merge' command-line option for that? I failed to find one.\n>> >\n>> > There isn't, unless you count\n>> >\n>> >     $ git -c merge.conflictstyle=diff3 merge side-branch\n>> >\n>> > as a \"command line option\" (which may technically is).\n>> \n>> Yeah, I thought of maybe making an alias for that, so apparently I do\n>> count it as command line option, thanks!\n>\n> You can also do it after \"git merge\" aborts with conflicts by running:\n>\n>   git checkout --conflict=diff3 my-file\n>\n> but do note that it will check out from the index, overwriting any\n> resolution you've already done in that file.\n\nReally nice trick, thanks for sharing!\n\nThough now it gets really odd \"git merge\" itself doesn't have this\noption.\n\n-- Sergey\n"},{"id":"401966","messageId":"xmqqimedq5c8.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"87blk6yrlc.fsf@osv.gnss.ru","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-23T21:39:03Z","receivedAt":"2020-07-23T21:39:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>> You can also do it after \"git merge\" aborts with conflicts by running:\n>>\n>>   git checkout --conflict=diff3 my-file\n>>\n>> but do note that it will check out from the index, overwriting any\n>> resolution you've already done in that file.\n>\n> Though now it gets really odd \"git merge\" itself doesn't have this\n> option.\n\nA command line option is cumbersome that you have to type it every\ntime, so configuration variable makes 100% more sense than an option\nto \"git merge\".  \n\nIf your merge used the merge (as opposed to diff3) style, and seeing\nthat the resulting conflict is not easy to review and you wish you\nused diff3 style instead, it is way too late for any option to \"git\nmerge\" to help you.\n\nBut having an option to \"git checkout\" lets you move forward from\nthat state, so it also makes 100% more sense than an option to \"git\nmerge\".\n\nSo, it is not odd at all.  Just compare between merge and diff3,\nthink which one would often help you, configure to use it by default,\n*and* at a rare occasion where the chosen default does not work for\nyou, let \"checkout\" help you.  The thing is, unless you first attempt\nto \"git merge\", you won't know what shape of conflict you would get,\nso you cannot choose the right conflict style command line option,\neven if one were available.\n"},{"id":"401984","messageId":"xmqqk0ytn208.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"20200723182549.GB3975154@coredump.intra.peff.net","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-24T01:19:19Z","receivedAt":"2020-07-24T01:19:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> sub flush {\n>   print @ours;\n>   print \"|||||||\\n\";\n>   show_diff(base => \\@base, ours => \\@ours);\n>   print \"|||||||\\n\";\n>   show_diff(base => \\@base, theirs => \\@theirs);\n>   print \"=======\\n\";\n\nBefore this gets called, \"<<<<<<<\\n\" from the original has been\nemitted to the output, so this shows\n\n\t<<<<<<<\n\tversion from ours\n\t|||||||\n\toutput from diff -u base ours\n\t|||||||\n\toutput from diff -u base theirs\n\t=======\n\tversion from theirs\n\n   print @theirs;\n>   @ours = @base = @theirs = ();\n> }\n\nUnfortunately, there is no \">>>>>>>\" shown with this code, as $_\nseems to get clobbered before the sub returns, so ...\n\n> sub state_theirs {\n>   if (/^>{7}/) { flush(); print; $state = \\&state_none }\n>   else { push @theirs, $_ }\n> }\n\n... that \"print\" does not do what we want it to do.\n\nLocalizing the $_ upfront in the show_diff sub should probably be\nsufficient.  That is ...\n\n> sub show_diff {\n>   my ($pre_name, $pre_data, $post_name, $post_data) = @_;\n\n+  local ($_);\n\n... here.\n\n>\n>   my $pre = File::Temp->new;\n>   print $pre @$pre_data;\n\nI am debating myself if I want to see the base version between these\ntwo extra diffs.  Perhaps there is no need, as either one of these\ntwo extra diffs should be sufficient to see what was in the base\nversion.\n\nThanks.\n"},{"id":"401987","messageId":"CA+P7+xpPDu900dao08wfYtZ2pqU89D9vmwQPuFT-z5S5b-DXNA@mail.gmail.com","threadId":"53898","inReplyTo":"xmqqimedq5c8.fsf@gitster.c.googlers.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2020-07-24T05:15:23Z","receivedAt":"2020-07-24T05:15:37Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Thu, Jul 23, 2020 at 2:43 PM Junio C Hamano <gitster@pobox.com> wrote:\n> If your merge used the merge (as opposed to diff3) style, and seeing\n> that the resulting conflict is not easy to review and you wish you\n> used diff3 style instead, it is way too late for any option to \"git\n> merge\" to help you.\n>\n> But having an option to \"git checkout\" lets you move forward from\n> that state, so it also makes 100% more sense than an option to \"git\n> merge\".\n>\n\nPerhaps the issue is just that it's not discoverable easily because\nit's a different command.\n"},{"id":"401988","messageId":"xmqqblk5moxx.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"CA+P7+xpPDu900dao08wfYtZ2pqU89D9vmwQPuFT-z5S5b-DXNA@mail.gmail.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-24T06:01:30Z","receivedAt":"2020-07-24T06:01:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jacob Keller <jacob.keller@gmail.com> writes:\n\n> On Thu, Jul 23, 2020 at 2:43 PM Junio C Hamano <gitster@pobox.com> wrote:\n>> If your merge used the merge (as opposed to diff3) style, and seeing\n>> that the resulting conflict is not easy to review and you wish you\n>> used diff3 style instead, it is way too late for any option to \"git\n>> merge\" to help you.\n>>\n>> But having an option to \"git checkout\" lets you move forward from\n>> that state, so it also makes 100% more sense than an option to \"git\n>> merge\".\n>\n> Perhaps the issue is just that it's not discoverable easily because\n> it's a different command.\n\nThat may be true.\n\nBy the way, \"git checkout --conflict=<style>\" is a short-hand for\n\"git checkout --merge --conflict=<style>\" and it is quite useful not\njust in the said case of \"oops, I cannot read this conflict with the\n'merge' style---let's switch to 'diff3' style\".  After starting to\nattempt resolving the conflict, sometimes I become unsure if the\nresolution I've been working on is correct, and want to start from\nscratch.  In such a case, even without switching the style to a\ndifferent one, \"git checkout --merge\" to discard the changes I made\nin the working tree file and reproduce the auto-merged state with\nconflict markers, is a good tool in your toolbox to know (being able\nto give a different conflict style is merely a natural extension of\nthe feature).\n\nPerhaps in Documentation/git-merge.txt there can be a mention of\n\n\tWhen you really screwed up your resolution, you could use\n\t\"git checkout --merge -- $paths\" to revert selected paths\n\tback to the state just before the auto-merge gave up and\n\tasked your help in resolving.  The --conflict=<style> option\n\tcan be used instead of the \"--merge\" option in the command\n\tto use a different conflict marking style.  See\n\tgit-checkout[1] for details.\n\nor something along that line.  People who are unware of \"checkout -m\"\nin such a situation may run \"git reset --hard\" and redo the whole\nmerge from scratch, but you do not have to discard the resolution\nyou made in other paths successfully only to redo a few files that\nyou botched.\n\n"},{"id":"401989","messageId":"874kpxwghu.fsf@osv.gnss.ru","threadId":"53898","inReplyTo":"xmqqimedq5c8.fsf@gitster.c.googlers.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-07-24T06:53:49Z","receivedAt":"2020-07-24T06:53:54Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>>> You can also do it after \"git merge\" aborts with conflicts by running:\n>>>\n>>>   git checkout --conflict=diff3 my-file\n>>>\n>>> but do note that it will check out from the index, overwriting any\n>>> resolution you've already done in that file.\n>>\n>> Though now it gets really odd \"git merge\" itself doesn't have this\n>> option.\n>\n> A command line option is cumbersome that you have to type it every\n> time, so configuration variable makes 100% more sense than an option\n> to \"git merge\".\n\nFortunately Git already supports configuration variable, that we both\nagree is a nice thing to have, so I won't have to type the option every\ntime, no.\n\n> If your merge used the merge (as opposed to diff3) style, and seeing\n> that the resulting conflict is not easy to review and you wish you\n> used diff3 style instead, it is way too late for any option to \"git\n> merge\" to help you.\n\n  $ git merge --abort\n  $ git merge --conflict=diff3 side-branch\n\nor, say, entirely imaginary:\n\n  $ git merge --redo --conflict=diff3 side-branch -- my-file\n\nif merge had --redo option and path limiting support, that could be\nhandy for other reasons as well, as I have already pointed elsewhere and\nyou disagreed, but still.\n\n>\n> But having an option to \"git checkout\" lets you move forward from\n> that state, so it also makes 100% more sense than an option to \"git\n> merge\".\n\nActually, \"git checkout\" is not the place where I'd expect to find this\nfeature in the first place, so to me it's rather already 99%\nillogical.\n\nIf \"git merge\" is what gave me the original result, it's some \"git\nmerge\" variant that I'd expect to give me modified result as well.\n\nYeah, I can see how Git machinery is an excuse for \"git checkout\" to end\nup being used for this feature, but only after I learned it is.\n\n> So, it is not odd at all.  Just compare between merge and diff3,\n> think which one would often help you, configure to use it by default,\n> *and* at a rare occasion where the chosen default does not work for\n> you, let \"checkout\" help you.  The thing is, unless you first attempt\n> to \"git merge\", you won't know what shape of conflict you would get,\n> so you cannot choose the right conflict style command line option,\n> even if one were available.\n\nWhat looks odd to me is that for \"git merge\" I need to use:\n\n   $ git -c merge.conflictstyle=diff3 merge side-branch\n\nas you yourself pointed, whereas for \"git checkout\" I can use:\n\n   $ git checkout --conflict=diff3 my-file\n\neven though it could have been:\n\n   $ git -c merge.conflictstyle=diff3 checkout -m my-file\n\nas far as I can tell. A minor inconsistency, but still.\n\nIf I got your arguments right, you think that having short-cut option\nfor \"git checkout\" makes sense, while having similar one for \"git merge\"\ndoesn't, whereas my argument is that either both make sense, or both\ndon't.\n\nAnyway, it's nice we can still do these things, one way or another.\n\nThanks,\n-- Sergey\n"},{"id":"402014","messageId":"20200724194840.GA4013174@coredump.intra.peff.net","threadId":"53898","inReplyTo":"xmqqk0ytn208.fsf@gitster.c.googlers.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-07-24T19:48:40Z","receivedAt":"2020-07-24T19:48:43Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 23, 2020 at 06:19:19PM -0700, Junio C Hamano wrote:\n\n> Unfortunately, there is no \">>>>>>>\" shown with this code, as $_\n> seems to get clobbered before the sub returns, so ...\n\nAh yeah, thanks for pointing it out (as you might guess I was mainly\nlooking at the diff output to see if it was broken ;) ).\n\nYour suggested fix is probably what I'd do (I really wish perl localized\n$_ automatically when entering new blocks, but I suspect they would\nnever do so because of compatibility).\n\n> >   my $pre = File::Temp->new;\n> >   print $pre @$pre_data;\n> \n> I am debating myself if I want to see the base version between these\n> two extra diffs.  Perhaps there is no need, as either one of these\n> two extra diffs should be sufficient to see what was in the base\n> version.\n\nYeah, I didn't give too much thought to the output, but was afraid of\nmaking it too long and hard to read. In addition to whether to show the\nbase, I also wondered whether we could omit the \"---/+++\" header for\neach diff. It's mostly boilerplate, and the signal of \"hey, this is the\ndiff between 'base' and 'ours'\" could be done on the \"|||||||\" line\n(which also could potentially use a different character to be more\ndistinct).\n\nI was also tempted to remove the hunk header since the line numbers are\nfairly useless. But it is possible for the diff to have multiple hunks,\nand you'd still want to show that.\n\nMy big challenge now will be remembering to try to use this next time I\nrun into a conflict that could be helped by it. :)\n\n-Peff\n"},{"id":"402020","messageId":"xmqqblk4ll9u.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"20200724194840.GA4013174@coredump.intra.peff.net","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-24T20:18:21Z","receivedAt":"2020-07-24T20:18:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> My big challenge now will be remembering to try to use this next time I\n> run into a conflict that could be helped by it. :)\n\nYup, I installed it in ~/bin so that I can pipe diff3 result to it\nfor the next time.  Thanks.\n"},{"id":"402022","messageId":"xmqq7duslkp0.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"874kpxwghu.fsf@osv.gnss.ru","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-24T20:30:51Z","receivedAt":"2020-07-24T20:31:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>> If your merge used the merge (as opposed to diff3) style, and seeing\n>> that the resulting conflict is not easy to review and you wish you\n>> used diff3 style instead, it is way too late for any option to \"git\n>> merge\" to help you.\n>\n>   $ git merge --abort\n>   $ git merge --conflict=diff3 side-branch\n>\n> or, say, entirely imaginary:\n>\n>   $ git merge --redo --conflict=diff3 side-branch -- my-file\n>\n> if merge had --redo option and path limiting support, that could be\n> handy for other reasons as well, as I have already pointed elsewhere and\n> you disagreed, but still.\n\nYou are ignoring the case where you may have successfully resolved\nconflicts in some paths before you noticed conflicts in some\nparticular files are hard to see in one style and wish if you used\nthe other style, I think.\n\nSurely, you can reset everything away and redo it from scratch,\nwhich is what all of the above is, but then you would need a way to\nstash away the successful half resolution so far before discarding\nthem.  Compared to that, \"ouch, I screwed up and want a freshly\nconflicted state back for these paths\" would allow you revert only\nthe botched paths without discarding the work you have already done.\n\n> Actually, \"git checkout\" is not the place where I'd expect to find this\n> feature in the first place, so to me it's rather already 99%\n> illogical.\n\nOne half of the \"checkout\" (which now exists as a synonym \"restore\")\nis to update the working tree files out of various sources, and\n\"conflicted stages in the index\" is one of them, so it entirely is\nnatural and logical home for the feature.\n\nThe documentation needs updating to help you and others feel it\nnatural, I would think.  This seems to be mostly the matter of\nbetter education.\n\n"},{"id":"402028","messageId":"87tuxwimvm.fsf@osv.gnss.ru","threadId":"53898","inReplyTo":"xmqq7duslkp0.fsf@gitster.c.googlers.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-07-24T22:11:57Z","receivedAt":"2020-07-24T22:12:03Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Sergey Organov <sorganov@gmail.com> writes:\n>\n>>> If your merge used the merge (as opposed to diff3) style, and seeing\n>>> that the resulting conflict is not easy to review and you wish you\n>>> used diff3 style instead, it is way too late for any option to \"git\n>>> merge\" to help you.\n>>\n>>   $ git merge --abort\n>>   $ git merge --conflict=diff3 side-branch\n>>\n>> or, say, entirely imaginary:\n>>\n>>   $ git merge --redo --conflict=diff3 side-branch -- my-file\n>>\n>> if merge had --redo option and path limiting support, that could be\n>> handy for other reasons as well, as I have already pointed elsewhere and\n>> you disagreed, but still.\n>\n> You are ignoring the case where you may have successfully resolved\n> conflicts in some paths before you noticed conflicts in some\n> particular files are hard to see in one style and wish if you used\n> the other style, I think.\n\nI believe I'm not, or if I do, then you are ignoring the opposite case\nthat you may need to redo entire merge with different merge style\noutput.\n\nIn other words, I only aimed at decreasing 100% down to at most 80% in\nyour claim:\n\n>>> so configuration variable makes 100% more sense than an option\n>>> to \"git merge\".\n\nbecause you can only claim 100% if nobody ever needs to redo the merge\nfrom scratch, that is obviously not the case.\n\n> Surely, you can reset everything away and redo it from scratch,\n> which is what all of the above is,\n\nNo, only first two commands are reset and redo everything from scratch,\nwhereas the third command supposedly only affects 'my-file' path:\n\n  $ git merge --redo --conflict=diff3 side-branch -- my-file\n\nAnyway, my primary point was that I still might wish to do exactly reset\nand start from scratch, and then I miss --conflict option, that in turn\nmakes its existence less than 100% less sense than configuration\nvariable, my estimation being about 80%.\n\n> but then you would need a way to stash away the successful half\n> resolution so far before discarding them. Compared to that, \"ouch, I\n> screwed up and want a freshly conflicted state back for these paths\"\n> would allow you revert only the botched paths without discarding the\n> work you have already done.\n>\n>> Actually, \"git checkout\" is not the place where I'd expect to find this\n>> feature in the first place, so to me it's rather already 99%\n>> illogical.\n>\n> One half of the \"checkout\" (which now exists as a synonym \"restore\")\n> is to update the working tree files out of various sources, and\n> \"conflicted stages in the index\" is one of them, so it entirely is\n> natural and logical home for the feature.\n\nI believe I already agreed it makes sense the feature ends up being\nthere, and I perfectly understand this /after/ I learned it's there, but\nI'm still afraid I'd not figure out to look for it there in the first\nplace.\n\n> The documentation needs updating to help you and others feel it\n> natural, I would think.  This seems to be mostly the matter of\n> better education.\n\nYeah, it's education that helps most when things get unintuitive enough.\n\nBetter documentation always helps indeed, and description of --conflict\noption in \"man git-merge\" would be the best place to put a reference to\n\"git checkout -m\" (or should it rather be \"git restore -m\" nowadays?)\nthat you've suggested elsewhere in this thread ;-)\n\nThanks,\n-- Sergey\n"},{"id":"402030","messageId":"xmqqft9gjz0m.fsf@gitster.c.googlers.com","threadId":"53898","inReplyTo":"87tuxwimvm.fsf@osv.gnss.ru","subject":"Re: Improving merge of tricky conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-24T23:04:25Z","receivedAt":"2020-07-24T23:04:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n> Anyway, my primary point was that I still might wish to do exactly reset\n> and start from scratch, and then I miss --conflict option, that in turn\n> makes its existence less than 100% less sense than configuration\n> variable, my estimation being about 80%.\n\nAs with other uses of \"update working tree files from elsewhere\" use\nof \"checkout\", \"--merge/--conflict=<style>\" checkout does take\npathspec to specify what paths are to be updated.  Nothing stops you\nto give \".\" (everything under the sun) pathspec there, so I do not\nreally see the point of insisting \"I want to start and redo from\nscratch\".  \n\nUnless the reason is \"because that is the way I am used to\", that\nis.  Surely, we can start and redo from scratch any operation, not\nlimited to merges, by removing the entire repository and cloning it\nagain from scratch.  I am trying to give our users tools to help\nthem not get into that habit and instead always make forward\nprogress without discarding work that has already been done.\n\n"},{"id":"414482","messageId":"CANiSa6iV3WbS9VQdUQ-eF=dcz-mmQXvyckGJL8ZhpgFYc7U_TQ@mail.gmail.com","threadId":"53898","inReplyTo":"20200723182549.GB3975154@coredump.intra.peff.net","subject":"Re: Improving merge of tricky conflicts","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2021-01-16T02:50:08Z","receivedAt":"2021-01-16T02:51:04Z","isPatch":false,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Thu, Jul 23, 2020 at 8:27 AM Jeff King <peff@peff.net> wrote:\n>\n> On Wed, Jul 22, 2020 at 10:26:04AM -0700, Junio C Hamano wrote:\n>\n> > > The big downside here, of course, is that it's showing the diff for the\n> > > whole file, not just one hunk (on the other hand, I often find the\n> > > trickiest conflicts are ones where the changes unexpectedly span\n> > > multiple hunks).\n> >\n> > Yup, I often find myself comparing the base part (lines between |||\n> > and ===) with our part (lines between <<< and |||) and their part\n> > (lines between === and >>>) while looking at the diff3 output to see\n> > what unique change each side did, in order to come up with a\n> > conflict resolution.\n> >\n> > I do this often enough to wonder if I should write a small \"filter\"\n> > that I can pipe a whole \"diff3\" <<< ... ||| ... === ... >>> region\n> > to and convert it into to diffs, but not often enough to motivate\n> > me to actually write one ;-).\n>\n> I would definitely have found that useful before (usually when one side\n> made a tiny one-line change and the other side deleted or drastically\n> changed a huge chunk).\n\nFYI, I added something similar to Mercurial recently. Instead of two\ndiffs, it shows one snapshot and one diff. See\nhttps://phab.mercurial-scm.org/D9551 for details. I've used it for a\nfew weeks and it seems to be working pretty well. The drawback is\nmostly when you want to keep the side with the diff and ignore the\nother side, since you'll then have to drop the lines prefixed with \"-\"\nand then enter column-selection mode or something and delete the first\ncharacter on each remaining line.\n"},{"id":"414903","messageId":"YAmPnfb/KMlqimhH@coredump.intra.peff.net","threadId":"53898","inReplyTo":"CANiSa6iV3WbS9VQdUQ-eF=dcz-mmQXvyckGJL8ZhpgFYc7U_TQ@mail.gmail.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-01-21T14:28:45Z","receivedAt":"2021-01-21T14:36:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 15, 2021 at 04:50:08PM -1000, Martin von Zweigbergk wrote:\n\n> > > I do this often enough to wonder if I should write a small \"filter\"\n> > > that I can pipe a whole \"diff3\" <<< ... ||| ... === ... >>> region\n> > > to and convert it into to diffs, but not often enough to motivate\n> > > me to actually write one ;-).\n> >\n> > I would definitely have found that useful before (usually when one side\n> > made a tiny one-line change and the other side deleted or drastically\n> > changed a huge chunk).\n> \n> FYI, I added something similar to Mercurial recently. Instead of two\n> diffs, it shows one snapshot and one diff. See\n> https://phab.mercurial-scm.org/D9551 for details. I've used it for a\n> few weeks and it seems to be working pretty well. The drawback is\n> mostly when you want to keep the side with the diff and ignore the\n> other side, since you'll then have to drop the lines prefixed with \"-\"\n> and then enter column-selection mode or something and delete the first\n> character on each remaining line.\n\nI've used the script I posted earlier in the thread several times in the\nlast 6 months or so, by replacing the conflict markers in the file I'm\nresolving with the new output (basically \"%!magic-diff3\" in vim).\n\nIt is helpful. My biggest complaint is cleaning up the diff from the\nmarker after viewing it. In most cases where it's helpful, one side made\na large change (say, deleting or moving a big chunk of code) and the\nother made a small one (tweaking one line in the moved chunk). The small\ndiff is useful, but the big one is not. And then after having viewed it,\nI have to remove the whole big diff in my editor.\n\n(It sounds like yours _replaces_ the conflict marker with the diff,\nwhich is why you have to edit the diff. Mine is showing it in addition,\nso you have to delete the diff).\n\nI think rather than thinking of these as expanded conflict markers, it\nwould probably be a more useful workflow to just look at the diff in a\nseparate command (so just show the conflicts, not everything else, and\njust show the diff). I suspect it could be made pretty nice with some\nsimple editor support (e.g., open a new buffer in the editor showing the\ndiff for just the current hunk, or even the current _half_ of the hunk\nyou're on).\n\n-Peff\n"},{"id":"414920","messageId":"CANiSa6jsjrm-i+T1zSBMFqpUqy-PJpai39JtH47m=v1TO_fi4A@mail.gmail.com","threadId":"53898","inReplyTo":"YAmPnfb/KMlqimhH@coredump.intra.peff.net","subject":"Re: Improving merge of tricky conflicts","fromName":"Martin von Zweigbergk","fromEmail":"martinvonz@gmail.com","sentAt":"2021-01-21T20:30:36Z","receivedAt":"2021-01-21T20:32:33Z","isPatch":false,"sender":{"key":"martinvonz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/891642?v=4"},"body":"On Thu, Jan 21, 2021 at 4:28 AM Jeff King <peff@peff.net> wrote:\n>\n> On Fri, Jan 15, 2021 at 04:50:08PM -1000, Martin von Zweigbergk wrote:\n>\n> > > > I do this often enough to wonder if I should write a small \"filter\"\n> > > > that I can pipe a whole \"diff3\" <<< ... ||| ... === ... >>> region\n> > > > to and convert it into to diffs, but not often enough to motivate\n> > > > me to actually write one ;-).\n> > >\n> > > I would definitely have found that useful before (usually when one side\n> > > made a tiny one-line change and the other side deleted or drastically\n> > > changed a huge chunk).\n> >\n> > FYI, I added something similar to Mercurial recently. Instead of two\n> > diffs, it shows one snapshot and one diff. See\n> > https://phab.mercurial-scm.org/D9551 for details. I've used it for a\n> > few weeks and it seems to be working pretty well. The drawback is\n> > mostly when you want to keep the side with the diff and ignore the\n> > other side, since you'll then have to drop the lines prefixed with \"-\"\n> > and then enter column-selection mode or something and delete the first\n> > character on each remaining line.\n>\n> I've used the script I posted earlier in the thread several times in the\n> last 6 months or so, by replacing the conflict markers in the file I'm\n> resolving with the new output (basically \"%!magic-diff3\" in vim).\n>\n> It is helpful. My biggest complaint is cleaning up the diff from the\n> marker after viewing it. In most cases where it's helpful, one side made\n> a large change (say, deleting or moving a big chunk of code) and the\n> other made a small one (tweaking one line in the moved chunk). The small\n> diff is useful, but the big one is not. And then after having viewed it,\n> I have to remove the whole big diff in my editor.\n>\n> (It sounds like yours _replaces_ the conflict marker with the diff,\n> which is why you have to edit the diff. Mine is showing it in addition,\n> so you have to delete the diff).\n\nYes, that's correct. It replaces the base and one side of the conflict\nmarker by a diff (and leaves the other side as a snapshot).\n\n> I think rather than thinking of these as expanded conflict markers, it\n> would probably be a more useful workflow to just look at the diff in a\n> separate command (so just show the conflicts, not everything else, and\n> just show the diff). I suspect it could be made pretty nice with some\n> simple editor support (e.g., open a new buffer in the editor showing the\n> diff for just the current hunk, or even the current _half_ of the hunk\n> you're on).\n\nAt some point it seems better to delegate to a proper merge tool. You\nsaid that you use vim, so I'm a little surprised that you use conflict\nmarkers instead of using vimdiff. I don't use vim and I've never\nreally used vimdiff. I still use conflict markers, mostly out of\nhabit, but also because I usually run in a tmux session on a remote\nmachine. I feel like I should try to switch to meld.\n"},{"id":"414927","messageId":"YAntTS6UQIUWZngD@coredump.intra.peff.net","threadId":"53898","inReplyTo":"CANiSa6jsjrm-i+T1zSBMFqpUqy-PJpai39JtH47m=v1TO_fi4A@mail.gmail.com","subject":"Re: Improving merge of tricky conflicts","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-01-21T21:08:29Z","receivedAt":"2021-01-21T21:11:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 21, 2021 at 10:30:36AM -1000, Martin von Zweigbergk wrote:\n\n> > I think rather than thinking of these as expanded conflict markers, it\n> > would probably be a more useful workflow to just look at the diff in a\n> > separate command (so just show the conflicts, not everything else, and\n> > just show the diff). I suspect it could be made pretty nice with some\n> > simple editor support (e.g., open a new buffer in the editor showing the\n> > diff for just the current hunk, or even the current _half_ of the hunk\n> > you're on).\n> \n> At some point it seems better to delegate to a proper merge tool. You\n> said that you use vim, so I'm a little surprised that you use conflict\n> markers instead of using vimdiff. I don't use vim and I've never\n> really used vimdiff. I still use conflict markers, mostly out of\n> habit, but also because I usually run in a tmux session on a remote\n> machine. I feel like I should try to switch to meld.\n\nYeah, I think your first sentence might be the most important takeaway. ;)\n\nI have tried using vimdiff in the past, but didn't really like it. My\nrecollection is that it was clunky to navigate, and I could fix most\nconflicts much faster just by looking at them. But I have never been a\nheavy user of the multi-window multi-buffer stuff in vim. My \"open a new\nbuffer in the editor\" is probably a lie; for me it is more like \"open a\nnew terminal and run a command at the shell\". :)\n\n-Peff\n"}]}