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

Re: question about conflict resolution across multiple branches

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 19, 2009, 20:11 UTC
Message-ID
<7viqm58e8r.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1237483813-sup-5631@entry>
William Morgan <wmorgan-git@masanjin.net> writes:
Show 5 quoted lines
> Sometimes those topic branches are remote branches on someone else's
> repo. What happens when merging a remote topic branch into next creates
> a conflict? Ideally I'd like for the topic branch author to deal with
> resolving the conflict, and leave me to my carefree maintainer existence
> of eating icecream on the couch.

Well, merging, applying and managing the conflicts between contributors is what the maintainers do. If you push that to your contributors, you do not have to exist ;-).

> ... In the no-conflict case, I merge their
> remote branch directly into my local next. But in the case of conflicts,
> it seems like me only way to acquire their resolution is to merge their
> next branch entirely into mine. Is that true?

It is not clear what you mean by 'their next' as the only thing you told us is "some topic are from elsewhere". Do you mean the originator of the topic also keeps an integration branch of his own, something similar to your 'next'?

If that is the case, I _think_ you can fetch their next and feed the merge you are interested in to rerere-train.sh (in contrib) before you attempt the merge yourself. This is "I _think_" because I never used that script myself (and it wasn't even accepted to git.git by me---I was away back then).

> Likewise, what happens when someone sends a patch against master to the
> mailing list, and applying that patch to next creates a conflict? Is
> there any way for them to resolve the conflict, and pass that resolution
> to me?

You can tell the contributor that the area the patch touches is under an active development that you expect to be ready soon, and ask him to redo the patch on a specific commit on the topic.

Or you can ask the contributor to do this:
    $ git fetch ;# from you
    $ git checkout origin/master ;# detach to your master
    $ git am the-patch
    $ git merge origin/next ;# this will conflict you cannot resolve
    $ edit to resolve conflicts
    $ git commit ;# the resolution you cannot come up with yourself
    $ git diff origin/next >fixup.patch
and send the fixup.patch to you.  You would do the reverse:
    $ git checkout master
    $ git am the-patch
    $ git checkout next
    $ git merge -s ours master
    $ git apply --index fixup.patch
    $ git commit --amend
    $ git show ;# to review what the fix-up did

Needless to say, you need to be careful when accepting such a fixup patch.

Previous: William MorganNext: William Morgan
Message 2 of 3 in “question about conflict resolution across multiple branches”
  1. William MorganMar 19, 2009
  2. Junio C HamanoMar 19, 2009
  3. William MorganMar 22, 2009

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.