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

q: faster way to integrate/merge lots of topic branches?

From
IMIngo Molnar <mingo@elte.hu>
Date
Jul 23, 2008, 13:05 UTC
Message-ID
<20080723130518.GA17462@elte.hu>

I've got the following, possibly stupid question: is there a way to merge a healthy number of topic branches into the master branch in a quicker way, when most of the branches are already merged up?

Right now i've got something like this scripted up:
  for B in $(git-branch | cut -c3- ); do git-merge $B; done 
It takes a lot of time to run on even a 3.45GHz box:
  real    0m53.228s
  user    0m41.134s
  sys     0m11.405s

I just had a workflow incident where i forgot that this script was running in one window (53 seconds are a _long_ time to start doing some other stuff :-), i switched branches and the script merrily chugged away merging branches into a topic branch i did not intend.

It iterates over 140 branches - but all of them are already merged up.

Anyone can simulate it by switching to the linus/master branch of the current Linux kernel tree, and doing:

   time for ((i=0; i<140; i++)); do git-merge v2.6.26; done
   real    1m26.397s
   user    1m10.048s
   sys     0m13.944s

One could argue that determining whether it's all merged up already is a complex task, but but even this seemingly trivial merge of HEAD into HEAD is quite slow:

   time for ((i=0; i<140; i++)); do git-merge HEAD; done
   real    0m17.871s
   user    0m8.977s
   sys     0m8.396s

I'm wondering whether there are tricks to speed this up. The real script i'm using is much longer and obscured with boring details like errors, conflicts, etc. - but the above is the gist of it. (and that is what makes it slow primarily)

Using a speculative Octopus might be one approach, but that runs into the octopus merge limitation at 24 branches, and it also is quite slow as well. (and is not equivalent to the serial merge of 140 branches)

I have thought of using the last CommitDate of the topic branch and compare it with the last CommitDate of the master branch [and i can trust those values] - that would be a lot faster - but maybe i'm missing something trivial that makes that approach unworkable. It would also be nice to have a builtin shortcut for that instead of having to go via "git-log --pretty=fuller" to dump the CommitDate field.

builtin-integrate.c perhaps? ;-)
	Ingo
Next: Ingo Molnar
Message 1 of 32 in “q: faster way to integrate/merge lots of topic branches?”
  1. Ingo MolnarJul 23, 2008
  2. Ingo MolnarJul 23, 2008
  3. Ingo MolnarJul 23, 2008
  4. Jay SoffianJul 23, 2008
  5. Ingo MolnarJul 23, 2008
  6. Ingo MolnarJul 23, 2008
  7. Andreas EricssonJul 23, 2008
  8. Ingo MolnarJul 23, 2008
  9. Miklos VajnaJul 23, 2008
  10. Sergey VlasovJul 23, 2008
  11. Ingo MolnarJul 23, 2008
  12. Ingo MolnarJul 23, 2008
  13. SZEDER GáborJul 23, 2008
  14. Ingo MolnarJul 23, 2008
  15. Junio C HamanoJul 23, 2008
  16. 1/2 builtin-branch.c: remove unused code in append_ref() callback functionJunio C Hamano, Jul 23, 2008
  17. builtin-branch.c: optimize --merged and --no-mergedJunio C Hamano, Jul 23, 2008
  18. Lars HjemliJul 24, 2008
  19. Nanako ShiraishiJul 24, 2008
  20. Lars HjemliJul 24, 2008
  21. Ingo MolnarJul 24, 2008
  22. Linus TorvaldsJul 23, 2008
  23. Linus TorvaldsJul 23, 2008
  24. Junio C HamanoJul 23, 2008
  25. Ingo MolnarJul 24, 2008
  26. Junio C HamanoJul 25, 2008
  27. Björn SteinbrinkJul 23, 2008
  28. Santi BéjarJul 23, 2008
  29. Linus TorvaldsJul 23, 2008
  30. Pierre HabouzitJul 23, 2008
  31. Pierre HabouzitJul 23, 2008
  32. Pierre HabouzitJul 23, 2008

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.