Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Steps to faster git on mac.

  1. Update to git 2.16

  2. Setup file monitoring with hgwatchman

    1. Run
    $ brew install watchman
    $ cd /path/to/mozilla-central
    $ watchman watch-project .
    1. Download my slightly modified version of the default git fsmonitor-watchman hook from here and put it at .git/hooks/fsmonitor-watchman.
    2. Run git config --local core.fsmonitor ".git/hooks/fsmonitor-watchman"
  3. Enable git's split-index feature

    1. Run
    $ git update-index --split-index
    $ git config --system core.splitIndex true
    1. Optionally, run git config --local splitIndex.maxPercentChange 10. The default is 20, which is too high for repos the size of gecko. YMMV for a good value, you can also skip this and run git update-index --split-index whenever things start getting slow to force it to re-split the index.
  4. Enable git's untracked file cache

    1. Run git update-index --test-untracked-cache. If it tells you you can, then
    2. Run git update-index --untracked-cache, and git config --system core.untrackedCache true.
  5. If you still have a slow prompt, it's probably computing modifications in a bad way. Parsing them out of git status --porcelain is the fastest, but many use git diff --name-only or similar, which is very slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment