git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John M. Dlugosz" <ngnr63q02@sneakemail.com>
To: git@vger.kernel.org
Subject: Re: How to merge from newer branch to older branches?
Date: Tue, 21 Apr 2009 23:46:32 -0500	[thread overview]
Message-ID: <gsm7fm$q31$1@ger.gmane.org> (raw)
In-Reply-To: <2729632a0904211224x6e2621caxf6c169d90b760530@mail.gmail.com>

skillzero@gmail.com wrote:
> 
> future o-o-o-o-o-o-o
>         \   \       \
> 1.2          o-o-o   \
>           \           \
> 1.1        o-o-o       \
>                         \
> feature                  o-o-o
>                          a b c
> 
> Is cherry-picking the best way? It seems pretty tedious because I have
> to do each commit in reverse order (although I could script it). I was
> hoping there was a way to say "apply all the changes from when
> "feature" branched up to its tip". I would also like to preserve the
> commit history rather than just making making one big commit of all
> the changes.

I think any other command that "just" moves those deltas would be the exact equivalent of 
cherry picking in terms of the conflicts it sees.

You can, however, collapse a,b,c into one commit and pick that into each place it is 
needed, calling it a good comment for the whole feature.  That might be more difficult to 
merge than doing one at a time, but if not, and the whole string is tedious (i.e. 50 
instead of 3, mostly incremental typo fixes and stuff) I can see the benefit of making it 
a gestalt.

Furthermore... (thinking out loud)... the conflicts are caused by things after the other 
branches, right?  After you do the resolving for (say) 1.2, then instead of picking a,b,c 
again (with the same merge issues), pick the one you put onto 1.2 already.  Work your way 
that way from branches that came off nearest to the original feature, back down toward the 
  root.  Each time pick the one you just planted, because it already contains merges part 
way down.  Then you only have to deal with the changes between those two branches.

So that's what I'd do:  pick a, b, and c onto the most recient other branch (1.2 in your 
drawing), fixing merge as I go.  Then reset mixed back to the original tip before the 
picks, and commit everything with a good name for the feature.  Then, pick that onto the 
next newest branch (1,1 in your drawing), etc.

--John

      parent reply	other threads:[~2009-04-22  4:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21 19:24 How to merge from newer branch to older branches? skillzero
2009-04-21 19:36 ` Jeff King
2009-04-22  5:13   ` Junio C Hamano
2009-04-22 13:34     ` Jeff King
2009-04-22 17:44     ` skillzero
2009-04-22 20:15       ` Jeff King
2009-04-22 21:01         ` skillzero
2009-04-22 21:17           ` Jeff King
2009-04-22  4:46 ` John M. Dlugosz [this message]

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='gsm7fm$q31$1@ger.gmane.org' \
    --to=ngnr63q02@sneakemail.com \
    --cc=git@vger.kernel.org \
    /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).