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

Re: more merge strategies : feature request

From
Jeff King <peff@peff.net>
Date
Dec 2, 2008, 03:30 UTC
Message-ID
<20081202033013.GD6804@coredump.intra.peff.net>
In-Reply-To
<81bfc67a0812011838m68100020v727da1c06f0bcee4@mail.gmail.com>
On Mon, Dec 01, 2008 at 09:38:07PM -0500, Caleb Cushing wrote:
Show 9 quoted lines
> conflict: when auto-merging isn't merging the way you want it too, but
> you still want to see the diffs and handle them by hand. no commit
> won't do this, it just doesn't commit. I've had 2 situations now where
> git's fast-forward has overwritten changes in a branch I didn't want
> it to, it would have been better if I could handle them by hand
> without having to have 1 terminal open to the diff and the other open
> to the editor to fix it. and yes git was right by it's perspective,
> but the code it created was wrong by what I wanted and needed. I'm not
> really sure what more of a use case is needed for this.

It's not clear to me exactly what you want. Let's say I have a file 'foo' with changes from my merged branches in two different spots. For example:

 merge base     branch A      branch B
    1              2             1
    2              3             2
    3              4             3
    4              5             4
    5

Did you want conflict markers in the resulting file? If so, what should the conflict markers look like, since there isn't actually a conflict?

Alternatively, you could have git leave the file in an unmerged state, and then access the base, ours, and theirs version from the index (or even use git mergetool). Then you would get your desired versions into the merging tool of your choice.

Of course, you could also just use a custom merge driver to accomplish the same thing:

  git config merge.xxdiff.driver 'xxdiff %A %O %B'
  echo '* merge=xxdiff' >.gitattributes
  git merge your-branch

and of course you can specify whatever subset of files you want to actually do this for instead of '*'.

-Peff
Previous: Caleb CushingNext: Caleb Cushing
Message 4 of 13 in “more merge strategies : feature request”
  1. Caleb CushingNov 29, 2008
  2. Andreas EricssonDec 1, 2008
  3. Caleb CushingDec 2, 2008
  4. Jeff KingDec 2, 2008
  5. Caleb CushingDec 2, 2008
  6. Jeff KingDec 2, 2008
  7. Leo RazoumovDec 2, 2008
  8. Caleb CushingDec 2, 2008
  9. Leo RazoumovDec 3, 2008
  10. Nanako ShiraishiDec 3, 2008
  11. Caleb CushingDec 3, 2008
  12. Junio C HamanoDec 4, 2008
  13. Nanako ShiraishiDec 4, 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.