git/list[1] front-page[2] threads[3] people[4] search[5] about
 

merge conflict diff

From
JRJeremy Ramer <jdramer@gmail.com>
Date
Apr 3, 2008, 14:13 UTC
Message-ID
<b9fd99020804030713n3c1a2602t847e8a132f8ccd06@mail.gmail.com>
Hi,
I am trying to figure out how to quickly diff two source files that
led to a merge conflict.  When a conflict occurs the command
# git diff
performs a diff -cc, but I would like to compare the files before any
merging takes place so I can decide if I should just take all the
changes from one of the sources.
 i.e. take the changes from the merging branch:
# git checkout-index -f -u --stage=3 foo
# git add foo

So far I am thinking of # git checkout-index --stage=2 --temp foo # git checkout-index --stage=3 --temp foo # git diff .merge_x1 .merge_x2

Are there any built-in ways to accomplish this? I'd like to be able to build a script that can quickly start the diff based on the file name I provide.

Thanks! Jeremy

Next: Jeff King
Message 1 of 4 in “merge conflict diff”
  1. Jeremy RamerApr 3, 2008
  2. Jeff KingApr 3, 2008
  3. Jeremy RamerApr 3, 2008
  4. Matthieu MoyApr 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.