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

Re: best practices against long git rebase times?

From
John Keeping <john@keeping.me.uk>
Date
Dec 4, 2015, 15:31 UTC
Message-ID
<20151204153103.GP18913@serenity.lan>
In-Reply-To
<20151204150546.GA17210@inner.h.apk.li>
On Fri, Dec 04, 2015 at 04:05:46PM +0100, Andreas Krey wrote:
Show 15 quoted lines
> our workflow is pretty rebase-free for diverse reasons yet.
> 
> One obstacle now appearing is that rebases simply take
> very long - once you might want to do a rebase there are
> several hundred commits on the remote branch, and our tree
> isn't small either.
> 
> This produces rebase times in the minute range.
> I suppose this is because rebase tries to see
> if there are new commits in the destination
> branch that are identical to one of the local
> commits, to be able to skip them. (I didn't
> try to verify this hypothesis.)
> 
> What can we do to make this faster?

I'm pretty sure that you're right and the cherry-pick analysis is where the time is spent.

I looked into this a couple of years ago and I have a variety of (half-finished) experiments that might improve the performance of this:

	https://github.com/johnkeeping/git/commits/log-cherry-no-merges
	https://github.com/johnkeeping/git/commits/patch-id-limit-paths
	https://github.com/johnkeeping/git/commits/revision-cherry-respect-ancestry-path
	https://github.com/johnkeeping/git/commits/patch-id-notes-cache
	http://comments.gmane.org/gmane.comp.version-control.git/224006

I have no idea if any of these changes will apply to modern Git (or if some of them are even correct) but I can try to clean them up if there's interest.

The commit for patch-id-limit-paths includes some numbers that might be relevant for your case:

    Before:
    $ time git log --cherry master...jk/submodule-subdirectory-ok >/dev/null
    
    real    0m0.373s
    user    0m0.341s
    sys     0m0.031s
    
    After:
    $ time git log --cherry master...jk/submodule-subdirectory-ok >/dev/null
    
    real    0m0.060s
    user    0m0.055s
    sys     0m0.005s
Previous: Andreas KreyNext: Andreas Krey
Message 2 of 13 in “best practices against long git rebase times?”
  1. Andreas KreyDec 4, 2015
  2. John KeepingDec 4, 2015
  3. Andreas KreyDec 6, 2015
  4. Jeff KingDec 7, 2015
  5. Junio C HamanoDec 7, 2015
  6. Jeff KingDec 7, 2015
  7. Junio C HamanoDec 8, 2015
  8. Christian CouderDec 8, 2015
  9. demerphqDec 4, 2015
  10. John KeepingDec 4, 2015
  11. demerphqDec 4, 2015
  12. Stefan BellerDec 4, 2015
  13. Andreas KreyDec 6, 2015

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.