"git merge" merges too much!

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

 



I'm trying to learn to use Git to manage local changes.  I'm very new to
Git (hi all!), but not new at all to version tracking tools in general.

Hope I've found the right list on which to ask potentially naive
questions!  I've been doing _lots_ of reading about Git, but I can't
seem to find anything about the problems I relate below.

One task I'm working on is to try to find the best way to merge changes
made from one branch to another, eg. to propagate local fixes from one
release to another.

However in at least one simple case "git merge" merges too much.

I have something like this started from a remote-cloned repository where
BL1.2 is a branch from the remote master HEAD, which happens to
correspond to a tag "TR1.2", the release-1.2 tag, and I've made three
local commits to my local BL1.2 branch: A, B, and C:

                                         BL1.2 - A - B - C  <- BL1.2 HEAD
                                        /
master 1 - 2 - TR1.1 - 3 - 4 - 5 - TR1.2  <- master HEAD


(there are no "release" branches in this project, just tags on the
master branch to represent release points -- is there any way to get
"git log" to show which tags are associated with a given commit and/or
branch?  The real project is freedesktop.org's xinit repo, but the real
tree is too messy to diagram here -- hopefully I've extracted the
essence of the problem correctly)

I now want to create a branch "BL1.1" and merge commits A, B, and C to it
in order to back-port my local fixes to the TR1.1 release.  "TR1.1" is
simply a tag on the origin/master trunk.

I do the following:

	git checkout -b BL1.1 TR1.1
	git merge BL1.2

However this seems to merge all of 3, 4, and 5, as well as A, B, and C.

I think I can (barely) understand why it's doing what it's doing, but
that's not what I want it to do.  However it looks like Git doesn't have
the same idea of a branch "base" point as I think I do.

Running "git log TR1.2..BL1.2" does show me exactly the changes I wish
to propagate, but "git merge TR1.2..BL1.2" says "not something we can
merge".  Sigh.

How can I get it to merge just the changes from the "base" of the BL1.2
branch to its head?

Is using either git-cherry-pick or "git log -p | git-am", the only way
to do this?  Which way best preserves Git's ability to realize if a
change has already been included on the target branch, if any?

Is this the kind of "problem" that drove the creators of Stacked-Git to
invent their tools?

Is there any way to get "git log --graph" (and/or gitk) to show me all
the branch heads, not just the current/specified one?

-- 
						Greg A. Woods

+1 416 218-0098                VE3TCP          RoboHack <woods@xxxxxxxxxxx>
Planix, Inc. <woods@xxxxxxxxxx>      Secrets of the Weird <woods@xxxxxxxxx>

Attachment: pgpKr4q3sFO9n.pgp
Description: PGP signature


[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]