git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Lane Brooks <lane@brooks.nu>
Cc: Git List <git@vger.kernel.org>
Subject: Re: How to manage merges from one line while excluding its merges from another
Date: Fri, 25 Jun 2010 19:03:58 -0500	[thread overview]
Message-ID: <20100626000358.GA11473@burratino> (raw)
In-Reply-To: <4C252D1C.4010702@brooks.nu>

Hi Lane,

Lane Brooks wrote:

> I have a tree like this:
> 
>      G---H---I---J---K   devel
>     /       /       /
> A---B---C---D---E---F    main
>         \
>          L---M---N---O   my

Nice diagram.

What is missing is a picture of what you want the result to be.

> The 'my' branch forked off the 'main' line and for reasons out of my
> control cannot merge the 'main' changes (D,E,F) back.
[...]
> I want to continue to merge from the devel line as additional commits
> are made that are not on the main branch, but I do not want any of
> the future merge commits.

(I) I am guessing that the 'main' line is not part of the published
history, in which case you what you want might look like this:

         ... devel
      /
 A---B---C- ... main
          \
           L---M---N---O---H'---J' my

The J commit itself could not be included in the history of the 'my'
branch because its ancestor D is not meant to be published.

(II) In an alternative scenario, the 'main' changes (D, E, F) are
forbidden because they introduce bugs.  In this case, a solution might
look something like this:

       ...                  K devel
     /               /       \
A---B---C---D---E---F main    \
         \                     \
          L---M---N---O---------P---Q---R---S

where Q, R, and S are commits (created with ‘git revert’) that
undo the effect of F, E, and D.  From then on, you can just merge
from devel as usual.

> Is there an automated way to do this or do I have to cherry pick
> everything by hand?

In git 1.7.2, you will be able to automate (I) as follows:

 git cherry-pick --no-merges ^my ^main devel

Until then, you might want to try experimenting with something
like this:

 git rev-list --no-merges ^my ^main devel |
 while read rev
 do
	git cherry-pick $rev ||
	{
		echo >&2 cherry-pick failed
		break
	}
 done

Hope that helps,
Jonathan

  reply	other threads:[~2010-06-26  0:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-25 22:26 How to manage merges from one line while excluding its merges from another Lane Brooks
2010-06-26  0:03 ` Jonathan Nieder [this message]
2010-06-26  0:35   ` Lane Brooks
2010-06-26  0:51     ` Jonathan Nieder

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

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

  git send-email \
    --in-reply-to=20100626000358.GA11473@burratino \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=lane@brooks.nu \
    /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.
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 NNTP newsgroup(s).