git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: More gitweb queries..

From
Linus Torvalds <torvalds@osdl.org>
Date
May 27, 2005, 20:03 UTC
Message-ID
<Pine.LNX.4.58.0505271248450.17402@ppc970.osdl.org>
In-Reply-To
<20050527192941.GE7068@cip.informatik.uni-erlangen.de>
On Fri, 27 May 2005, Thomas Glanzmann wrote:
Show 7 quoted lines
> 
> > I get the urge to do octopus-merges in the kernel just because of how
> > good they look in gitk ;) ]
> 
> talking about octopus-merges ... I don't understand how they work. What
> happens if one file is touched in every of the 8 trees. How can that be
> handled?
Automatically? You can do multiple three-way merges, no problem. 

In fact, the general algorithm for an n-way merge is to just do the "git-resolve-script" n-1 times, but _without_ the commit. Then you just commit the result, and the only thing to keep in mind is to get the parents right, because if you don't, you're screwed.

This does imply a merge ordering, but since we order the parents anyway, that's actually also described 100% by the commit, so the end result is clean and good.

There are two reasons not to do octopus-merges, and neither of them is huge, but they've kept me from doing them..

 - if you screw up half-way through the merge, it's a lot harder to 
   recover without blowing away all the other merges too and having to 
   re-do them. You certainly _can_ do it (say, by just recording the trees
   in between merges - it's definitely not rocket science), but it
   basically means that you need to keep track of things _outside_ of the
   normal "what was the last HEAD" model.
   More importantly, since an octopus merge has only one commit message 
   associated with it, you really should never use one for anything that 
   needs any manual intervention. Otherwise you'll have to start 
   explaining which merge you needed to fix up manually etc, and it just 
   gets complex for no actual gain.
   IOW, this argument is only against complex merges. The trivial ones can 
   easily be done as octopuses, and in many ways the resulting history may 
   actually reflect what you did better. For example, for somebody like 
   Jeff, who maintains 50 different branches, and merges 5 of them to send 
   them to me, an octopus merge in many ways is much more intuitive: it 
   really says "I took these five branches and combined them", while a 
   series of four regular merges just gets messy.
 - Compatibility with other systems. 
   I don't care one whit about stuff I consider broken (ie CVS), but there 
   are SCM's out there that I _don't_ think are broken, and that don't do
   multi-parent merges for "nrparent > 2".  You can always split an 
   octopus merge that didn't have any manual intervention, so again, this
   is not a huge argument if you follow rule #1, but unless you have a 
   reason for doing an octopus merge, it means that you should probably 
   avoid it.
   So _I_ usually don't have any reason at all, it would be stupid of me
   to merge trees from different people as an octopus, but usage like 
   Jeff's (where the merge is due to "pass these <n> trees upwards") is 
   different.

So there you have it. Don't do it just because you can, but if you have a good reason for them and they were done automatically without any human intervention (apart from having to change the scripts, of course), I won't argue too much against them either. I already took one such merge from Junio in the GIT tree, and I actually like having that as a way to make sure the tools can handle it.

		Linus
Previous: Thomas GlanzmannNext: Junio C Hamano
Message 9 of 42 in “More gitweb queries..”
  1. Linus TorvaldsMay 27, 2005
  2. Thomas GlanzmannMay 27, 2005
  3. Junio C HamanoMay 27, 2005
  4. Thomas GlanzmannMay 27, 2005
  5. Junio C HamanoMay 27, 2005
  6. Linus TorvaldsMay 27, 2005
  7. Junio C HamanoMay 27, 2005
  8. Thomas GlanzmannMay 27, 2005
  9. Linus TorvaldsMay 27, 2005
  10. Junio C HamanoMay 27, 2005
  11. Thomas GlanzmannMay 27, 2005
  12. Junio C HamanoMay 27, 2005
  13. Linus TorvaldsMay 27, 2005
  14. Thomas GlanzmannMay 27, 2005
  15. Junio C HamanoMay 28, 2005
  16. Thomas GlanzmannMay 29, 2005
  17. Thomas GlanzmannMay 29, 2005
  18. Thomas GlanzmannMay 29, 2005
  19. Thomas GlanzmannMay 29, 2005
  20. Thomas GlanzmannMay 29, 2005
  21. Junio C HamanoMay 30, 2005
  22. Junio C HamanoMay 30, 2005
  23. Thomas GlanzmannMay 30, 2005
  24. Thomas GlanzmannMay 30, 2005
  25. Junio C HamanoMay 30, 2005
  26. Thomas GlanzmannMay 30, 2005
  27. Thomas GlanzmannMay 30, 2005
  28. Junio C HamanoMay 30, 2005
  29. Thomas GlanzmannMay 30, 2005
  30. Junio C HamanoMay 30, 2005
  31. Thomas GlanzmannMay 27, 2005
  32. Junio C HamanoMay 27, 2005
  33. Linus TorvaldsMay 27, 2005
  34. Benjamin HerrenschmidtMay 27, 2005
  35. Kay SieversMay 27, 2005
  36. Daniel SerpellMay 28, 2005
  37. David LangMay 28, 2005
  38. Kay SieversMay 28, 2005
  39. Kay SieversMay 28, 2005
  40. Benjamin HerrenschmidtMay 28, 2005
  41. Paul MackerrasMay 30, 2005
  42. Jeff EplerMay 31, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.