Git development
 help / color / mirror / Atom feed
* On merging strategies, fast forward and index merge
@ 2006-03-18 10:17 Mark Wooding
  2006-03-18 10:19 ` [PATCH] git-merge: New options `--no-fast-forward' and `--direct' Mark Wooding
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wooding @ 2006-03-18 10:17 UTC (permalink / raw)
  To: git

I recently read Junio's description of how to dig oneself out of a hole
using `git merge -s ours' (I'm learning to use the space...), and I've
realised there's a problem here.

The `ours' merge strategy is meant to create a merge commit whose tree
is in every way identical to that of the starting commit.  But `git
merge' won't always do this, because it doesn't always invoke the
strategy program.

Consider the command `git merge -s ours MESSAGE MASTER FAILED'.

  * If we've not actually messed with our MASTER since the FAILED branch
    departed, then MASTER is actually an ancestor of FAILED, and `git
    merge' will unhelpfully fast-forward us to the tip of the FAILED
    branch.  Instead of leaving the merge result like MASTER, it's made
    it entirely the wrong thing!

  * If both MASTER and FAILED have made changes, but to different files,
    then `git merge' will try an index-level merge, find that it
    succeeds, and leave us with a mixture of MASTER and FAILED files.
    Which is (in this case) entirely what we didn't want.

Additionally, it occurs to me that the fast-forwarding behaviour isn't
always what I want anyway.  Consider a merge of a topic branch:

  `git merge MESSAGE MASTER TOPIC'

If I allow fast-forward, I lose information about where the topic
started and ended.  This is a shame, particularly if I find other places
I want to apply those changes (either as a string of similar commits, or
squidged into a single one) onto other branches.

Because code speaks louder, I'll follow-up this article with a suggested
patch.

-- [mdw]

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

end of thread, other threads:[~2006-03-18 22:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-18 10:17 On merging strategies, fast forward and index merge Mark Wooding
2006-03-18 10:19 ` [PATCH] git-merge: New options `--no-fast-forward' and `--direct' Mark Wooding
2006-03-18 21:59   ` Junio C Hamano
2006-03-18 22:53     ` Junio C Hamano

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