From: Michael J Gruber <git@drmicha.warpmail.net>
To: Johannes Schindelin <johannes.schindelin@gmx.de>,
Eric Raible <raible@nextest.com>
Cc: git@vger.kernel.org
Subject: Re: Visualizing merge conflicts after the fact (using kdiff3)
Date: Thu, 18 Jun 2015 14:26:20 +0200 [thread overview]
Message-ID: <5582B8EC.1060205@drmicha.warpmail.net> (raw)
In-Reply-To: <87b840d8c73fd7e4e7597e2fd835c703@www.dscho.org>
Johannes Schindelin venit, vidit, dixit 16.06.2015 11:43:
> Hi Eric,
>
> On 2015-06-16 03:17, Eric Raible wrote:
>> I'm running 1.9.5.msysgit.1, but this is a general git question...
>>
>> Upon returning from a vacation, I was looking at what people had been
>> up to, and discovered on merge in which a colleague had resolved a merge
>> incorrectly. It turns out that he has pushed *many* merges over the past
>> year which had conflicts in my code, and now I don't trust any of them.
>>
>> So naturally I want to check each of them for correctness.
>>
>> I know about "git log -p -cc SHA -- path", but it really doesn't
>> show just the conflicts so there's just too much noise in that output.
>>
>> I use kdiff3 to resolve conflicts, so I'm looking for a way to
>> visualize these already-resolved conflicts with that tool.
>> As I said, there are many merges, so the prospect of checking
>> out each sha, doing the merge, and then comparing the results
>> is completely untenable.
>>
>> Can anyone help? Surely other people have wanted to review how
>> conflicts were resolved w/out looking at the noise of unconflicted
>> changes, right?
>
> 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.
>
> Something like this:
>
> ```bash
> mergecommit=$1
>
> # probably should verify that the working directory is clean, yadda yadda
>
> # recreate merge conflicts on an unnamed branch (Git speak: detached HEAD)
> git checkout $mergecommit^
> git merge $mergecommit^2 ||
> die "This merge did not have any problem!"
>
> # compare to the actual resolution as per the merge commit
> git diff $mergecommit
> ```
This type of request comes up often (for a reason). I'm wondering
whether we could support it more systematically, either by exposing the
steps above as a command, or by storing the unresolved merge somewhere
(leveraging stash or rerere).
> To list all the merge commits in the current branch, I would use the command-line:
>
> ```bash
> git rev-list --author="My Colleague" --parents HEAD |
> sed -n 's/ .* .*//p'
> ```
>
> (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.)
:)
"--merges" (aka "--min-parents=2") is your friend here.
>
> Hopefully this gives you good ideas how to proceed.
>
> Ciao,
> Johannes
>
Michael
next prev parent reply other threads:[~2015-06-18 12:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-16 1:17 Visualizing merge conflicts after the fact (using kdiff3) Eric Raible
2015-06-16 9:43 ` Johannes Schindelin
2015-06-16 20:17 ` Eric Raible
2015-06-18 12:26 ` Michael J Gruber [this message]
2015-06-18 13:05 ` Johannes Schindelin
2015-06-18 15:57 ` Junio C Hamano
2015-06-19 8:34 ` Michael J Gruber
2015-06-19 16:19 ` Junio C Hamano
2015-07-06 19:38 ` Sebastian Schuberth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5582B8EC.1060205@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=raible@nextest.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.