Re: How to merge in different order?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux