git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Not possible to see combined diff before committing a merge?
@ 2010-03-18  6:21 Jay Soffian
  2010-03-18  9:55 ` Michael J Gruber
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Soffian @ 2010-03-18  6:21 UTC (permalink / raw)
  To: git

Am I missing something, or is there no way to see combined diff output
after completing merge resolution on a conflicted merge but before
committing the merge?

$ git diff --cc [-- path]

works fine _until_ you've added the file to the index, at which point
you're hosed.

I think I want the combined diff between:

- What's in the index
- The first parent (ORIG_HEAD)
- The second parent (MERGE_HEAD)

And I don't think that's possible, sadly.

j.

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

* Re: Not possible to see combined diff before committing a merge?
  2010-03-18  6:21 Not possible to see combined diff before committing a merge? Jay Soffian
@ 2010-03-18  9:55 ` Michael J Gruber
  2010-03-18 15:21   ` Jay Soffian
  0 siblings, 1 reply; 3+ messages in thread
From: Michael J Gruber @ 2010-03-18  9:55 UTC (permalink / raw)
  To: Jay Soffian; +Cc: git

Jay Soffian venit, vidit, dixit 18.03.2010 07:21:
> Am I missing something, or is there no way to see combined diff output
> after completing merge resolution on a conflicted merge but before
> committing the merge?
> 
> $ git diff --cc [-- path]
> 
> works fine _until_ you've added the file to the index, at which point
> you're hosed.
> 
> I think I want the combined diff between:
> 
> - What's in the index
> - The first parent (ORIG_HEAD)
> - The second parent (MERGE_HEAD)
> 
> And I don't think that's possible, sadly.

The obvious attempt "git diff --cc --cached" does not work,
unfortunately, because the add cleared out the other stages from the index.

The funny thing is that after committing, git show will give you the
combined diff (again).

I guess that proves, again, that there can't be a symbolic ref like
INDEX because it just doesn't behave like one.

If there are no conflicted files left you could do a throw-away commit
with a temp index, but that looks ugly. Do we have a way of specifying a
3-way diff for some git diff --cc incarnation, i.e. pretending two
commits to be the parents and a third (or index) to be the merge result?

Junio would probably say that by adding the merge resolution you declare
that you're not interested in that part of the merge any more ;)

Michael

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

* Re: Not possible to see combined diff before committing a merge?
  2010-03-18  9:55 ` Michael J Gruber
@ 2010-03-18 15:21   ` Jay Soffian
  0 siblings, 0 replies; 3+ messages in thread
From: Jay Soffian @ 2010-03-18 15:21 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git

On Thu, Mar 18, 2010 at 5:55 AM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> If there are no conflicted files left you could do a throw-away commit
> with a temp index, but that looks ugly. Do we have a way of specifying a
> 3-way diff for some git diff --cc incarnation, i.e. pretending two
> commits to be the parents and a third (or index) to be the merge result?

It would seem that diff-index should take two <tree-ish>'s (it only
takes one) to support this.

> Junio would probably say that by adding the merge resolution you declare
> that you're not interested in that part of the merge any more ;)

The use case is that I use mergetool when I have merges with very
large conflicted regions that are too difficult to visualize using the
merge and/or diff3 conflict style. But because these conflict
resolutions are so difficult, I often want to look at the merge
resolution in combined-diff style before committing.

The way I would have to do this today is:

- git mergetool <path>
- save the result in my visual merge tool and quit
- in a separate shell, use git diff to see the 3-way diff
- in the first shell, answer mergetool's prompt that it's okay to use the result

Hmm, maybe there should be an option for whether mergetool
automatically add's the result for you.

Anyway, what I've noticed is that I've become gun shy about using "git
add" myself during conflict resolution because as soon as I do, I lose
some functionality compared to the unmerged state.

j.

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

end of thread, other threads:[~2010-03-18 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18  6:21 Not possible to see combined diff before committing a merge? Jay Soffian
2010-03-18  9:55 ` Michael J Gruber
2010-03-18 15:21   ` Jay Soffian

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).