git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: David <wizzardx@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: User's mailing list? And multiple cherry pick
Date: Wed, 4 Jun 2008 10:50:08 +0200	[thread overview]
Message-ID: <200806041050.09701.jnareb@gmail.com> (raw)
In-Reply-To: <18c1e6480806040111s606701dfwc8a2ae5f742307b5@mail.gmail.com>

On Wed, 4 June 2008, David wrote:
> 
> Thanks, but this doesn't quite solve the problem. I'm on the verge of
> figuring it out, and would appreciate any further tips :-)
> 
> Here is an example:
> 
> o--o--O master
>        \
>         o--o--X--X--X--X--o--o topic
> 
> I want to copy the "X" patches from the topic branch over to master.
> The other patches aren't appropriate for master for whatever reason.
> eg, temporary debugging hacks, but I fixed a few problems in master in
> the X patches and now want to apply them on top of master, and keep
> working on "topic"
> 
> I want to end up with a tree like this:
> 
> 
> o--o--O--X'--X'--X'--X' master
>        \
>         o--o--X--X--X--X--o--o topic

I think the simplest solution would be to mark old master, change it
to topic (merge or branch -f), and use interactive rebase.

  $ git checkout master
  $ git branch TMP
         
  o--o--O *master, TMP
         \
          o--o--X--X--X--X--o--o topic

where '*master' means that 'master' is current branch.

Then to rewind 'master' to 'topic' you can use either
  $ git merge topic 
which should fast-forward to 'topic', or use git-reset
  $ git reset --hard topic

  o--o--O TMP
         \
          o--o--X--X--X--X--o--o topic, *master

Then there is simply a matter of rebasing master interactively, picking 
commits marked X.

  $ git rebase --interactive TMP
  # pick commits marked X in above diagram, backup (save) both original
  # list of commits, and final list of commits.

It is now safe to delete 'TMP' branch

  $ git branch -d TMP

  o--o--O--X'--X'--X'--X' *master
         \
          o--o--X--X--X--X--o--o topic

Now, if all goes well it would be simply a matter of rebasing 'topic' on 
top of 'master'; git-rebase would skip commits that are already there.

If it is not the case, use interactive rebase again, this time picking 
commits marked 'o' (if you saved original series, and list of commits 
rebased, this should be fairly easy to find/do).
 
> After getting the branches like this, I would then (try to) rebase
> topic like this:
> 
> o--o--O--X'--X'--X'--X' master
>                       \
>                        o'--o'--o'--o' topic

And here you are.

HTH
-- 
Jakub Narebski
Poland

  reply	other threads:[~2008-06-04  8:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04  6:55 User's mailing list? And multiple cherry pick David
2008-06-04  6:58 ` Junio C Hamano
2008-06-04  7:13   ` David
2008-06-04  8:05     ` Jakub Narebski
2008-06-04  8:23       ` Johan Herland
2008-06-04  8:30       ` David
2008-06-04  9:39         ` Wincent Colaiuta
2008-06-04 10:02           ` David
2008-06-04 11:02             ` Wincent Colaiuta
2008-06-04 11:09             ` Jakub Narebski
2008-06-04 18:09             ` Björn Steinbrink
2008-06-04  8:16     ` Johan Herland
2008-06-04  7:39 ` Jakub Narebski
2008-06-04  8:11   ` David
2008-06-04  8:50     ` Jakub Narebski [this message]
2008-06-04  9:37       ` David
2008-06-04  9:47         ` Jakub Narebski
2008-06-04 11:36     ` Theodore Tso
2008-06-04 10:38   ` Karl Hasselström
2008-06-04 11:10     ` Miklos Vajna
2008-06-04  8:00 ` Stephan Beyer
2008-06-04  8:20   ` David

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=200806041050.09701.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=wizzardx@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.
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).