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

Slow git add . performance in large repo

From
YRYissachar Radcliffe <yissachar@block.xyz>
Date
Mar 17, 2025, 18:53 UTC
Message-ID
<CAOHNGAW7ucD+xqvEuvq2GHMc42+WdKJX44XGguadK_y=pMf0Vg@mail.gmail.com>

We have a relatively large git repo and have noticed that `git add .` operations are slow (~1.5-2s). We have core.fsmonitor and core.untrackedCache set to true and `git status` executes in ~300ms. When I turn on trace2 I can see that almost all the time is spent in read_directo and it's visiting 26960 directories and 77989 paths.

I can use `git add <foo>` or `git add -u .` to speed things up but `git add .` is the most convenient for us. I created a small script to pipe the results of `git status` to `git add` and that runs in <500ms. This leaves me confused as to why the built-in performance is so slow.

git version is 2.49.0, mac os x 15.3
Next: brian m. carlson
Message 1 of 4 in “Slow git add . performance in large repo”
  1. Yissachar RadcliffeMar 17, 2025
  2. brian m. carlsonMar 17, 2025
  3. Yissachar RadcliffeMar 18, 2025
  4. brian m. carlsonMar 18, 2025

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.