Why are my git rebases slow now?
During the reworking and cleanup of a rather large feature branch, I noticed that some operations were fast and others were slow but didn’t think much of it and kept squashing and re-arranging. Until I happened to notice the 359% CPU usage for 1Password in Activity Monitor.
I had started to sign my commits using 1Password quite some time ago1 and in the day to day business you don’t notice it much. But this time, squashing two commits on a 400-ish commit branch took like several tens of seconds.
So I disabled it just for the repository with:
$ git config commit.gpgsign false
And behold! It was fast again (as in a tiny fraction of a second). I should have known because I have worked with larger codebases and change sets on less capable machines and do remember it to be as fast, but I reckon you get gradually used to it and then loose your own baseline.
Giving your git repository a good scrub
Don’t forget to append a --prune
to your fetches and do a git gc --aggressive
2 every now and then. Especially so when you create tens of thousands of temporary commits during a large rebase/cleanup.
-
Yes, I know some consider it to be harmful ↩
-
Yes, I know git does this automatically. ↩