{"thread":{"id":"18416","subject":"question about conflict resolution across multiple branches","startedAt":"2009-03-19T17:56:54Z","lastAt":"2009-03-22T20:05:34Z","messageCount":3,"participants":["William Morgan","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"108561","messageId":"1237483813-sup-5631@entry","threadId":"18416","inReplyTo":null,"subject":"question about conflict resolution across multiple branches","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2009-03-19T17:56:54Z","receivedAt":"2009-03-19T17:56:54Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Hi all,\n\nI have a git usage question about topic branches and conflicts.\n\nI maintain a project that I believe follows the standard topic branch\nmodel. It has two \"version\" branches, master and next. When a new\nfeature is introduced, I create a topic branch off of master, commit,\nand merge the topic into next. Users can check out next to play with all\nthe latest goodies. If a topic branch has problems, I add bugfix commits\nto it, and re-merge into next. Once it seems stable, I merge it into\nmaster. (Branching topic branches from master is necessary in order to\nbe able to merge them into master without pulling everything else that's\nin next.)\n\nSo this is nice, because I can pick and choose which features to have in\nmaster, more or less independently of each other. The one thing I\nhaven't been able to figure out is this:\n\nSometimes those topic branches are remote branches on someone else's\nrepo. What happens when merging a remote topic branch into next creates\na conflict? Ideally I'd like for the topic branch author to deal with\nresolving the conflict, and leave me to my carefree maintainer existence\nof eating icecream on the couch. In the no-conflict case, I merge their\nremote branch directly into my local next. But in the case of conflicts,\nit seems like me only way to acquire their resolution is to merge their\nnext branch entirely into mine. Is that true?\n\nLikewise, what happens when someone sends a patch against master to the\nmailing list, and applying that patch to next creates a conflict? Is\nthere any way for them to resolve the conflict, and pass that resolution\nto me?\n\nThanks for any help.\n-- \nWilliam <wmorgan-git@masanjin.net>\n"},{"id":"108577","messageId":"7viqm58e8r.fsf@gitster.siamese.dyndns.org","threadId":"18416","inReplyTo":"1237483813-sup-5631@entry","subject":"Re: question about conflict resolution across multiple branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-19T20:11:16Z","receivedAt":"2009-03-19T20:11:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"William Morgan <wmorgan-git@masanjin.net> writes:\n\n> Sometimes those topic branches are remote branches on someone else's\n> repo. What happens when merging a remote topic branch into next creates\n> a conflict? Ideally I'd like for the topic branch author to deal with\n> resolving the conflict, and leave me to my carefree maintainer existence\n> of eating icecream on the couch.\n\nWell, merging, applying and managing the conflicts between contributors is\nwhat the maintainers do.  If you push that to your contributors, you do\nnot have to exist ;-).\n\n> ... In the no-conflict case, I merge their\n> remote branch directly into my local next. But in the case of conflicts,\n> it seems like me only way to acquire their resolution is to merge their\n> next branch entirely into mine. Is that true?\n\nIt is not clear what you mean by 'their next' as the only thing you told\nus is \"some topic are from elsewhere\".  Do you mean the originator of the\ntopic also keeps an integration branch of his own, something similar to\nyour 'next'?\n\nIf that is the case, I _think_ you can fetch their next and feed the merge\nyou are interested in to rerere-train.sh (in contrib) before you attempt\nthe merge yourself.  This is \"I _think_\" because I never used that script\nmyself (and it wasn't even accepted to git.git by me---I was away back\nthen).\n\n> Likewise, what happens when someone sends a patch against master to the\n> mailing list, and applying that patch to next creates a conflict? Is\n> there any way for them to resolve the conflict, and pass that resolution\n> to me?\n\nYou can tell the contributor that the area the patch touches is under an\nactive development that you expect to be ready soon, and ask him to redo\nthe patch on a specific commit on the topic.\n\nOr you can ask the contributor to do this:\n\n    $ git fetch ;# from you\n    $ git checkout origin/master ;# detach to your master\n    $ git am the-patch\n    $ git merge origin/next ;# this will conflict you cannot resolve\n    $ edit to resolve conflicts\n    $ git commit ;# the resolution you cannot come up with yourself\n    $ git diff origin/next >fixup.patch\n\nand send the fixup.patch to you.  You would do the reverse:\n\n    $ git checkout master\n    $ git am the-patch\n    $ git checkout next\n    $ git merge -s ours master\n    $ git apply --index fixup.patch\n    $ git commit --amend\n    $ git show ;# to review what the fix-up did\n\nNeedless to say, you need to be careful when accepting such a fixup\npatch.\n"},{"id":"108926","messageId":"1237751617-sup-640@entry","threadId":"18416","inReplyTo":"7viqm58e8r.fsf@gitster.siamese.dyndns.org","subject":"Re: question about conflict resolution across multiple branches","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2009-03-22T20:05:34Z","receivedAt":"2009-03-22T20:05:34Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Reformatted excerpts from Junio C Hamano's message of 2009-03-19:\n>     $ git diff origin/next >fixup.patch\n\nOk, this is helpful. So git diff will give me an explicit dump of the\nconflict resolution changes, which I can use with git apply --index when\nI see the conflict. Sort of a manual, shared, git-rerere.\n\nWouldn't it be simpler for git format-patch to produce something for a\nmerge commit with conflicts? (Maybe there's a way and I just can't find\nit?)\n\n> Needless to say, you need to be careful when accepting such a fixup\n> patch.\n\nMore careful than when accepting a \"regular\" patch?\n\nThanks for your help!\n-- \nWilliam <wmorgan-git@masanjin.net>\n"}]}