From: Jeff King <peff@peff.net>
To: Josef Wolf <jw@raven.inka.de>, git@vger.kernel.org
Subject: Re: How to merge in different order?
Date: Fri, 3 Apr 2009 12:31:50 -0400 [thread overview]
Message-ID: <20090403163150.GD8155@coredump.intra.peff.net> (raw)
In-Reply-To: <20090403161208.GC28619@raven.wolf.lan>
On Fri, Apr 03, 2009 at 06:12:08PM +0200, Josef Wolf wrote:
> Given a branch that looks like
>
> A1 A2 A3 A4 A5
>
> I would like to merge into another branch in the order
>
> A1 A3 A4 A2 A5
>
> When I merge A3, then A2 is merged also. git-merge don't seem
> to have an option to omit slurping older commits?
Right. Remember that git represents history as a directed graph, so a
merge is really just another commit saying "I include all history
leading up to these two commits". There is no way to say "I include the
history leading up to these commits, minus some other commits".
If you just want to throw away A2, you can "git revert" it, then merge.
But what you probably want to do is rewrite the history of your branch
to re-order the commits. You can do this with "git rebase -i". Like any
history rewriting, this can cause difficulties for people who you have
already shared the branch with (because it will replace the commits that
they already have with 5 _new_ commits that just happen to do more or
less the same thing).
If you have already shared the branch, you may just want to cherry-pick
the changes you want (using "git cherry-pick") onto your other branch.
-Peff
next prev parent reply other threads:[~2009-04-03 16:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-03 16:12 How to merge in different order? Josef Wolf
2009-04-03 16:30 ` Peter Harris
2009-04-03 16:31 ` Jeff King [this message]
2009-04-03 17:59 ` Josef Wolf
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=20090403163150.GD8155@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jw@raven.inka.de \
/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).