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

Performance Issues with Git Rebase

From
CACrabtree, Andrew <andrew.crabtree@hp.com>
Date
Oct 12, 2014, 01:29 UTC
Message-ID
<B82B660D4887C042850326C2BC65FE035D56CA14@G4W3227.americas.hpqcorp.net>
I have what appears to be a fairly straightforward rebase operation and I can't figure out why it seems to effectively hang 'git rebase'.
I have a handful of commits that I made last summer and haven't touched since.  I'm trying to rebase them against latest on upstream.
git status
On branch git_enhancements
Your branch and 'origin/smb' have diverged,
and have 4 and 4665 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
If at this moment I type "git rebase" it will print out 
First, rewinding head to replay your work on top of it...
And then nothing will happen for approximately 30 minutes, and then it will complete.
  
If I instead type "git rebase --onto @{u} HEAD~4" it completes immediately.
I've narrowed it down to this line in git-rebase--am (approx. line 65)
	git format-patch -k --stdout --full-index --cherry-pick --right-only \
		--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
		"$revisions" ${restrict_revision+^$restrict_revision} \
		>"$GIT_DIR/rebased-patches"
Which is turned into this in my particular case
git format-patch -k --stdout --full-index --cherry-pick --right-only --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter 451da4975b25797fe54cd11e4796bbd3ee0911ce...ea3cf673d0e76504738bf130d48148d5b96cc406
If I time just that command I get 

real        32m10.324s user       26m21.296s sys          0m28.994s

If I change the triple do to a double dot I get 

real        0m4.276s user       0m0.096s sys          0m0.022s

Which is much more in line with how long I think the command should take.
The triple dot is coming from just earlier in the file here 
if test -z "$rebase_root"
	# this is now equivalent to ! -z "$upstream"
then
	revisions=$upstream...$orig_head
else
	revisions=$onto...$orig_head
fi
which seems to have been in place for 2+ years.  
I'm getting the same output with both the triple and double dot for my specific case, but I have no idea if that change makes sense for all cases or not.  Any guidance? 

Thanks much, -Andrew

Next: Junio C Hamano
Message 1 of 3 in “Performance Issues with Git Rebase”
  1. Crabtree, AndrewOct 12, 2014
  2. Junio C HamanoOct 13, 2014
  3. Crabtree, AndrewOct 13, 2014

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.