git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: David <wizzardx@gmail.com>
Cc: Jakub Narebski <jnareb@gmail.com>, git@vger.kernel.org
Subject: Re: User's mailing list? And multiple cherry pick
Date: Wed, 4 Jun 2008 07:36:20 -0400	[thread overview]
Message-ID: <20080604113620.GB7094@mit.edu> (raw)
In-Reply-To: <18c1e6480806040111s606701dfwc8a2ae5f742307b5@mail.gmail.com>

On Wed, Jun 04, 2008 at 10:11:33AM +0200, David wrote:
> 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
>
> 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
> 


OK, so assume the tree looks like this:

 o--o--O master
        \
         1--2--3--4--5--6--7--8 topic

First do a "git checkout topic; git rebase --interactive master", and
reorder the topic branch so it looks like this:

 o--o--O master
        \
         3--4--5--6--1--2--7--8 topic

Now find the commit ID for commit #6 above, and assuming that it's
f1dead2f, run the command "git checkout master; git merge f1dead2f".
Now the graph looks like this:

 o--o--O--3--4--5--6 master
                    \
                     1--2--7--8 topic

You could also use the command:

	"git update-ref refs/heads/master f1dead2f"

which keeps HEAD pointing at the topic branch, but the reason why I
suggested the "git checkout master; git merge f1dead2f" is that the
commands are generally more familiar to git newcomers, and I usually
want to do a test build and run the regression tests on master to make
sure things are clean.


> I say try to, because rebase sometimes gets a lot of dumb (to me,
> maybe I'm not using git correctly) conflicts in cases like this, so I
> end up manually rebasing, by making a new topic branch off master,
> cherry picking into it off the old topic branch, and then removing the
> old branch. Another case where multiple cherry picks would be nice :-)

Note that in the above set of commands, summarized as:

1) "git checkout topic; git rebase --interactive master"
   1a)  "make; make check" to build and run regression tests on the 
   	reordered topic branch.
2) "git checkout master; git merge f1dead2f" (this should be a fast forward)
   2a)  "make; make check" to build and run regression tests on the 
   	updated master branch.

There may be indeed conflicts at the first "git rebase --interactive",
but that's just git being conservative.  Usually it really isnt that
hard to resolve the conflicts, git add the files which required
fixups, and then doing a "git rebase --continue".  And you will have
to do the manual fixup regardless of whether you use "git rebase" or
"git cherry-pick"; the git rebase is just a more automated way of
doing things.

Regards,

						- Ted

  parent reply	other threads:[~2008-06-04 11:37 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
2008-06-04  9:37       ` David
2008-06-04  9:47         ` Jakub Narebski
2008-06-04 11:36     ` Theodore Tso [this message]
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=20080604113620.GB7094@mit.edu \
    --to=tytso@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --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).