public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* proper way to merge?
@ 2009-02-27 22:11 John Dlugosz
  2009-02-28  7:58 ` John Tapsell
  2009-03-02  8:33 ` Bryan Donlan
  0 siblings, 2 replies; 10+ messages in thread
From: John Dlugosz @ 2009-02-27 22:11 UTC (permalink / raw)
  To: git

I'm merging two branches: let's say "dev" is for development of future
releases, and "rel" is changes made to the current release for immediate
application.  Now I want to bring the changes made in rel back to dev.

Rather than trying to merge it all at once, I'm applying the changes a
few at a time and making sure it still compiles as I go.  Then,
git-reset and I have dev as my HEAD and the desired merge result in the
working tree.

Now, I want to introduce the proper commit node to show that this is the
graft.  But, I don't want to be presented with all the differences that
I already resolved; I know what it should look like already.  How do I
commit the current state of things and have it show up with both dev and
rel as parents? (then make that the new dev)

I'm also interesting in learning how to do it better next time.  But I'm
doing the incremental merging now and need to know how to conclude it.

--John

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
  If you received this in error, please contact the sender and delete the material from any computer.

^ permalink raw reply	[flat|nested] 10+ messages in thread
* proper way to merge?
@ 2009-03-02 23:08 John Dlugosz
  0 siblings, 0 replies; 10+ messages in thread
From: John Dlugosz @ 2009-03-02 23:08 UTC (permalink / raw)
  To: git

Thanks for the input, JohnFlux and Bryan.

Here's what I found worked.

First of all, the overall concept that changes to the repository are
never destructive (as long as you remember where you were) is
liberating.  It's beyond the confidence of an "undo" feature.  Really,
nothing I do can change any of the existing objects and their
interrelationship.  Using the reflog and lightweight tags, and the
feature that gitk still knows the nodes even after the labels move,
makes it easy to experiment on.

Basically, I cherry-picked the commits from "rel" to "dev" and fixed
them as I went.  Leaving it at that, I'd forever see duplicate commits
with the same comments but different actual commits, so things like "git
log here..there" will recognize the equality.

So, to make it look like I actually used the merge command, I did this:

1) I reset back to the original dev before my patching.  The default
reset, mixed, left the working tree unchanged and didn't do anything to
the index either.

2) git merge rel -s ours
That created a new node with the topology I wanted, but didn't actually
do anything.

3) add all the changed files, and "amend" the commit.


I suppose --no-commit would do the same thing as amending, but this way
I saw (in getk) that it really did what I wanted, instead of trusting
the multiple parentage to just be waiting somehow.

If keeping things in the working directory to carry between the steps
gives you the willies, remember that you can always reset --hard back to
where you were before doing (1).  Either because you tagged it just in
case, can find it using HEAD@{something}, or still see it on the screen
in gitk.

But, another approach would be to do the (fake) merge first, and then
keep amending it with the individual changes you pick from the other
branch.  I don't like that because the tree will show something that's
not true, until you are all done.  I want everything to be correct and
not lying if I get interrupted and leave it that way for a while.

Comments welcome.  I'm trying to get my act together before I start
evangelizing to the rest of the team.

--John
(excuse the footer; it's not my choice)

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
  If you received this in error, please contact the sender and delete the material from any computer.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-03-03 16:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-27 22:11 proper way to merge? John Dlugosz
2009-02-28  7:58 ` John Tapsell
2009-03-02 22:19   ` John Dlugosz
2009-03-03  5:01     ` John Tapsell
2009-03-02  8:33 ` Bryan Donlan
2009-03-02 22:44   ` John Dlugosz
2009-03-03  7:32     ` Johannes Sixt
2009-03-03 16:04       ` John Dlugosz
2009-03-03 16:15         ` Johannes Sixt
  -- strict thread matches above, loose matches on Subject: below --
2009-03-02 23:08 John Dlugosz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox