git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Chris Packham <judge.packham@gmail.com>
Cc: GIT <git@vger.kernel.org>
Subject: Re: Sharing merge conflict resolution between multiple developers
Date: Mon, 11 Aug 2014 11:44:11 -0700	[thread overview]
Message-ID: <xmqqd2c67tok.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAFOYHZCiKC4TR4jFVUB=W5qbDG8XvB2Obx1ZfTH8OF3E_c5BnA@mail.gmail.com> (Chris Packham's message of "Mon, 11 Aug 2014 16:59:15 +1200")

Chris Packham <judge.packham@gmail.com> writes:

> Is there any way where we could share the conflict resolution around
> but still end up with a single merge commit.

One idea that immediately comes to me is to use something like
"rerere" (not its implementation and storage, but the underlying
idea) enhanced with the trick I use to fix-up merges in my daily
integration cycle (look for "merge-fix" in howto/maintain-git.txt
in Documentation/).

> developer A:
>   git merge $upstream
>   <conflicts>

And then commit this immediately, together with conflict markers
(i.e. "commit -a"), and discard it with "reset --hard HEAD^" *after*
storing it somewhere safe.  And then redo the same merge, resolve
the conflicts and commit the usual way.

The difference between the final conflict resolution and the
original conflicted state can be used as a reference for others to
redo the same conflict resolution later elsewhere.  That can most
easily be done by creating a commit that records the final state
whose parent is the one you recorded the initial conflicted state.

So, the "recording" phase may go something like this:

    git checkout $this
    git merge $that
    git commit -a -m 'merge-fix/$this-$that preimage'
    git branch merge-fix/$this-$that
    git reset --hard HEAD^
    git merge $that
    edit
    git commit -a -m 'merge $that to $this'
    git checkout merge-fix/$this-$that
    git read-tree -m -u HEAD $this
    git commit -a -m 'merge-fix/$this-$that postimage'

The rough idea is "git show merge-fix/$this-$that" will show the
"patch" you can apply on top of the conflicted state other people
would get by running "git merge $that" while on "$this" branch.

"rerere" essentially does the above recording (and replaying)
per-path and it comes with a clever indexing scheme to identify
which previous conflict resolution would apply to the conflicts you
see in your working tree.

  reply	other threads:[~2014-08-11 18:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11  4:59 Sharing merge conflict resolution between multiple developers Chris Packham
2014-08-11 18:44 ` Junio C Hamano [this message]
2014-08-11 23:29   ` Chris Packham
2014-08-12  1:57     ` Junio C Hamano
     [not found] ` <CAP8UFD0_zfB_D-9EVZ4K=Zdq_G+9C-QhX7WED53zExV+Nv8Arg@mail.gmail.com>
2014-08-11 18:57   ` Christian Couder
2014-08-11 19:33 ` Nico Williams
2014-08-17  7:52 ` Jeff King
2014-08-17 13:30   ` Signinig a commit with multiple signatures Jason Pyeron
2014-08-19  8:05     ` Jeff King
2014-08-19 13:09       ` Jason Pyeron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd2c67tok.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=judge.packham@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).