{"thread":{"id":"39639","subject":"Visualizing merge conflicts after the fact (using kdiff3)","startedAt":"2015-06-16T01:17:17Z","lastAt":"2015-07-06T19:38:13Z","messageCount":9,"participants":["Eric Raible","Johannes Schindelin","Michael J Gruber","Junio C Hamano","Sebastian Schuberth"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"263914","messageId":"557F791D.3080003@nextest.com","threadId":"39639","inReplyTo":null,"subject":"Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Eric Raible","fromEmail":"raible@nextest.com","sentAt":"2015-06-16T01:17:17Z","receivedAt":"2015-06-16T01:17:17Z","isPatch":false,"sender":{"key":"raible@nextest.com","avatar":null},"body":"I'm running 1.9.5.msysgit.1, but this is a general git question...\n\nUpon returning from a vacation, I was looking at what people had been\nup to, and discovered on merge in which a colleague had resolved a merge\nincorrectly.  It turns out that he has pushed *many* merges over the past\nyear which had conflicts in my code, and now I don't trust any of them.\n\nSo naturally I want to check each of them for correctness.\n\nI know about \"git log -p -cc SHA -- path\", but it really doesn't\nshow just the conflicts so there's just too much noise in that output.\n\nI use kdiff3 to resolve conflicts, so I'm looking for a way to\nvisualize these already-resolved conflicts with that tool.\nAs I said, there are many merges, so the prospect of checking\nout each sha, doing the merge, and then comparing the results\nis completely untenable.\n\nCan anyone help?  Surely other people have wanted to review how\nconflicts were resolved w/out looking at the noise of unconflicted\nchanges, right?\n\nThanks - Eric (raible at gmail )\n"},{"id":"263921","messageId":"87b840d8c73fd7e4e7597e2fd835c703@www.dscho.org","threadId":"39639","inReplyTo":"557F791D.3080003@nextest.com","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-06-16T09:43:02Z","receivedAt":"2015-06-16T09:43:02Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Eric,\n\nOn 2015-06-16 03:17, Eric Raible wrote:\n> I'm running 1.9.5.msysgit.1, but this is a general git question...\n> \n> Upon returning from a vacation, I was looking at what people had been\n> up to, and discovered on merge in which a colleague had resolved a merge\n> incorrectly.  It turns out that he has pushed *many* merges over the past\n> year which had conflicts in my code, and now I don't trust any of them.\n> \n> So naturally I want to check each of them for correctness.\n> \n> I know about \"git log -p -cc SHA -- path\", but it really doesn't\n> show just the conflicts so there's just too much noise in that output.\n> \n> I use kdiff3 to resolve conflicts, so I'm looking for a way to\n> visualize these already-resolved conflicts with that tool.\n> As I said, there are many merges, so the prospect of checking\n> out each sha, doing the merge, and then comparing the results\n> is completely untenable.\n> \n> Can anyone help?  Surely other people have wanted to review how\n> conflicts were resolved w/out looking at the noise of unconflicted\n> changes, right?\n\nIf I was walking in your shoes, I would essentially recreate the merge conflicts and then use \"git diff <merge-commit>\" with the resolved merge in your current history.\n\nSomething like this:\n\n```bash\nmergecommit=$1\n\n# probably should verify that the working directory is clean, yadda yadda\n\n# recreate merge conflicts on an unnamed branch (Git speak: detached HEAD)\ngit checkout $mergecommit^\ngit merge $mergecommit^2 ||\ndie \"This merge did not have any problem!\"\n\n# compare to the actual resolution as per the merge commit\ngit diff $mergecommit\n```\n\nTo list all the merge commits in the current branch, I would use the command-line:\n\n```bash\ngit rev-list --author=\"My Colleague\" --parents HEAD |\nsed -n 's/ .* .*//p'\n```\n\n(i.e. listing all the commits with their parents, then filtering just the ones having more than one parent, which would include octopus merges if your history has them.)\n\nHopefully this gives you good ideas how to proceed.\n\nCiao,\nJohannes\n"},{"id":"263970","messageId":"5580844E.7070805@nextest.com","threadId":"39639","inReplyTo":"87b840d8c73fd7e4e7597e2fd835c703@www.dscho.org","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Eric Raible","fromEmail":"raible@nextest.com","sentAt":"2015-06-16T20:17:18Z","receivedAt":"2015-06-16T20:17:18Z","isPatch":false,"sender":{"key":"raible@nextest.com","avatar":null},"body":"\nOn 6/16/2015 2:43 AM, Johannes Schindelin wrote:\n> Hi Eric,\n> \n> On 2015-06-16 03:17, Eric Raible wrote:\n>> I'm running 1.9.5.msysgit.1, but this is a general git question...\n>>\n>> Upon returning from a vacation, I was looking at what people had been\n>> up to, and discovered on merge in which a colleague had resolved a merge\n>> incorrectly.  It turns out that he has pushed *many* merges over the past\n>> year which had conflicts in my code, and now I don't trust any of them.\n>>\n>> So naturally I want to check each of them for correctness.\n>>\n>> I know about \"git log -p -cc SHA -- path\", but it really doesn't\n>> show just the conflicts so there's just too much noise in that output.\n>>\n>> I use kdiff3 to resolve conflicts, so I'm looking for a way to\n>> visualize these already-resolved conflicts with that tool.\n>> As I said, there are many merges, so the prospect of checking\n>> out each sha, doing the merge, and then comparing the results\n>> is completely untenable.\n>>\n>> Can anyone help?  Surely other people have wanted to review how\n>> conflicts were resolved w/out looking at the noise of unconflicted\n>> changes, right?\n> \n> If I was walking in your shoes, I would essentially recreate the merge conflicts and then use \"git diff <merge-commit>\" with the resolved merge in your current history.\n> \n> Something like this:\n> \n> ```bash\n> mergecommit=$1\n> \n> # probably should verify that the working directory is clean, yadda yadda\n> \n> # recreate merge conflicts on an unnamed branch (Git speak: detached HEAD)\n> git checkout $mergecommit^\n> git merge $mergecommit^2 ||\n> die \"This merge did not have any problem!\"\n> \n> # compare to the actual resolution as per the merge commit\n> git diff $mergecommit\n> ```\n> \n> To list all the merge commits in the current branch, I would use the command-line:\n> \n> ```bash\n> git rev-list --author=\"My Colleague\" --parents HEAD |\n> sed -n 's/ .* .*//p'\n> ```\n> \n> (i.e. listing all the commits with their parents, then filtering just the ones having more than one parent, which would include octopus merges if your history has them.)\n> \n> Hopefully this gives you good ideas how to proceed.\n> \n> Ciao,\n> Johannes\n> .\n\nThanks for the reply, Johannes.\n\nThat basically the procedure that I did on just the one I stumbled across.\nBut what I really want is just a way to review how each conflicts was resolved\nw/out having to re-resolve each one myself.\n\ngitk (obviously) makes it trivial to view changes in normal commits, but given that\ngit provides such a straightforward conflict resolution model I'm surprised that there\nisn't a corresponding straightforward way of viewing those resolved conflicts in context.\n\nThanks - Eric\n"},{"id":"264176","messageId":"5582B8EC.1060205@drmicha.warpmail.net","threadId":"39639","inReplyTo":"87b840d8c73fd7e4e7597e2fd835c703@www.dscho.org","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-06-18T12:26:20Z","receivedAt":"2015-06-18T12:26:20Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Schindelin venit, vidit, dixit 16.06.2015 11:43:\n> Hi Eric,\n> \n> On 2015-06-16 03:17, Eric Raible wrote:\n>> I'm running 1.9.5.msysgit.1, but this is a general git question...\n>>\n>> Upon returning from a vacation, I was looking at what people had been\n>> up to, and discovered on merge in which a colleague had resolved a merge\n>> incorrectly.  It turns out that he has pushed *many* merges over the past\n>> year which had conflicts in my code, and now I don't trust any of them.\n>>\n>> So naturally I want to check each of them for correctness.\n>>\n>> I know about \"git log -p -cc SHA -- path\", but it really doesn't\n>> show just the conflicts so there's just too much noise in that output.\n>>\n>> I use kdiff3 to resolve conflicts, so I'm looking for a way to\n>> visualize these already-resolved conflicts with that tool.\n>> As I said, there are many merges, so the prospect of checking\n>> out each sha, doing the merge, and then comparing the results\n>> is completely untenable.\n>>\n>> Can anyone help?  Surely other people have wanted to review how\n>> conflicts were resolved w/out looking at the noise of unconflicted\n>> changes, right?\n> \n> If I was walking in your shoes, I would essentially recreate the merge conflicts and then use \"git diff <merge-commit>\" with the resolved merge in your current history.\n> \n> Something like this:\n> \n> ```bash\n> mergecommit=$1\n> \n> # probably should verify that the working directory is clean, yadda yadda\n> \n> # recreate merge conflicts on an unnamed branch (Git speak: detached HEAD)\n> git checkout $mergecommit^\n> git merge $mergecommit^2 ||\n> die \"This merge did not have any problem!\"\n> \n> # compare to the actual resolution as per the merge commit\n> git diff $mergecommit\n> ```\n\nThis type of request comes up often (for a reason). I'm wondering\nwhether we could support it more systematically, either by exposing the\nsteps above as a command, or by storing the unresolved merge somewhere\n(leveraging stash or rerere).\n\n> To list all the merge commits in the current branch, I would use the command-line:\n> \n> ```bash\n> git rev-list --author=\"My Colleague\" --parents HEAD |\n> sed -n 's/ .* .*//p'\n> ```\n> \n> (i.e. listing all the commits with their parents, then filtering just the ones having more than one parent, which would include octopus merges if your history has them.)\n\n:)\n\n\"--merges\" (aka \"--min-parents=2\") is your friend here.\n\n> \n> Hopefully this gives you good ideas how to proceed.\n> \n> Ciao,\n> Johannes\n> \n\nMichael\n"},{"id":"264178","messageId":"126a1ed453d1624083c069b904dd25c0@www.dscho.org","threadId":"39639","inReplyTo":"5582B8EC.1060205@drmicha.warpmail.net","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-06-18T13:05:17Z","receivedAt":"2015-06-18T13:05:17Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Micha,\n\nOn 2015-06-18 14:26, Michael J Gruber wrote:\n> Johannes Schindelin venit, vidit, dixit 16.06.2015 11:43:\n>\n>> To list all the merge commits in the current branch, I would use the command-line:\n>>\n>> ```bash\n>> git rev-list --author=\"My Colleague\" --parents HEAD |\n>> sed -n 's/ .* .*//p'\n>> ```\n>>\n>> (i.e. listing all the commits with their parents, then filtering just the ones having more than one parent, which would include octopus merges if your history has them.)\n> \n> :)\n> \n> \"--merges\" (aka \"--min-parents=2\") is your friend here.\n\nLearnt something!\n\nThanks,\nDscho\n"},{"id":"264192","messageId":"xmqqsi9pf1q2.fsf@gitster.dls.corp.google.com","threadId":"39639","inReplyTo":"5582B8EC.1060205@drmicha.warpmail.net","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-18T15:57:57Z","receivedAt":"2015-06-18T15:57:57Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> This type of request comes up often (for a reason). I'm wondering\n> whether we could support it more systematically, either by exposing the\n> steps above as a command, or by storing the unresolved merge somewhere\n> (leveraging stash or rerere).\n\nPerhaps 'tr/remerge-diff' (on 'pu') is of interest?\n"},{"id":"264281","messageId":"5583D40F.7030300@drmicha.warpmail.net","threadId":"39639","inReplyTo":"xmqqsi9pf1q2.fsf@gitster.dls.corp.google.com","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-06-19T08:34:23Z","receivedAt":"2015-06-19T08:34:23Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 18.06.2015 17:57:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> This type of request comes up often (for a reason). I'm wondering\n>> whether we could support it more systematically, either by exposing the\n>> steps above as a command, or by storing the unresolved merge somewhere\n>> (leveraging stash or rerere).\n> \n> Perhaps 'tr/remerge-diff' (on 'pu') is of interest?\n> \n\nIngenious!\n\nTo me, this seems to be the most useful view if you want to understand a\nmerge just from the parents and the merge commit. Since you would use\nthat for individual commits only, the cpu cycles are well spent.\n\nAs and added benefit, tr/remerge-diff merges to current next with\nconflicts (oid...) so that you get to test it on its own merge!\n\nI haven't reviewed remerge-diff but merged it on top of my own local\nadditions and ran the full test suite successfully. Any big blocker to\nwatch out for?\n\nMichael\n"},{"id":"264339","messageId":"xmqqwpyzacx3.fsf@gitster.dls.corp.google.com","threadId":"39639","inReplyTo":"5583D40F.7030300@drmicha.warpmail.net","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-19T16:19:36Z","receivedAt":"2015-06-19T16:19:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Junio C Hamano venit, vidit, dixit 18.06.2015 17:57:\n>> \n>> Perhaps 'tr/remerge-diff' (on 'pu') is of interest?\n>\n> I haven't reviewed remerge-diff but merged it on top of my own local\n> additions and ran the full test suite successfully. Any big blocker to\n> watch out for?\n\n\"What's cooking\" report marks it as \"Waiting for a\nreroll. ($gmane/256591).\"\n\nSo \n\n  http://thread.gmane.org/gmane.comp.version-control.git/256591\n\nwould be the first place to revisit.\n"},{"id":"265618","messageId":"559AD925.9030408@gmail.com","threadId":"39639","inReplyTo":"557F791D.3080003@nextest.com","subject":"Re: Visualizing merge conflicts after the fact (using kdiff3)","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2015-07-06T19:38:13Z","receivedAt":"2015-07-06T19:38:13Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On 16.06.2015 03:17, Eric Raible wrote:\n\n> So naturally I want to check each of them for correctness.\n\nSorry for joining this thread so late, I only come to know about it from the draft of the upcoming Git Rev News 5 [1].\n\nA while ago Robin Green was asking a very similar question on StackOverflow [2], and I came up with a script called \"git-show-merge-resolution.sh\" [3]. Maybe that's something you're interested in, too.\n\n[1] https://github.com/git/git.github.io/blob/master/rev_news/drafts/edition-5.md#support\n[2] stackoverflow.com/questions/24958182/kdiff3-to-code-review-merge-commit/24958228\n[3] https://github.com/sschuberth/dev-scripts/blob/master/git/git-show-merge-resolution.sh\n\n-- \nSebastian Schuberth\n"}]}