summaryrefslogtreecommitdiffstats
path: root/git-status.html
diff options
context:
space:
mode:
Diffstat (limited to 'git-status.html')
-rw-r--r--git-status.html76
1 files changed, 75 insertions, 1 deletions
diff --git a/git-status.html b/git-status.html
index 3804e58e9..ee69e21ce 100644
--- a/git-status.html
+++ b/git-status.html
@@ -1361,6 +1361,80 @@ using <code>git --no-optional-locks status</code> (see <a href="git.html">git(1)
</div>
</div>
<div class="sect1">
+<h2 id="_untracked_files_and_performance">UNTRACKED FILES AND PERFORMANCE</h2>
+<div class="sectionbody">
+<div class="paragraph"><p><code>git status</code> can be very slow in large worktrees if/when it
+needs to search for untracked files and directories. There are
+many configuration options available to speed this up by either
+avoiding the work or making use of cached results from previous
+Git commands. There is no single optimum set of settings right
+for everyone. We&#8217;ll list a summary of the relevant options to help
+you, but before going into the list, you may want to run <code>git status</code>
+again, because your configuration may already be caching <code>git status</code>
+results, so it could be faster on subsequent runs.</p></div>
+<div class="ulist"><ul>
+<li>
+<p>
+The <code>--untracked-files=no</code> flag or the
+ <code>status.showUntrackedfiles=false</code> config (see above for both):
+ indicate that <code>git status</code> should not report untracked
+ files. This is the fastest option. <code>git status</code> will not list
+ the untracked files, so you need to be careful to remember if
+ you create any new files and manually <code>git add</code> them.
+</p>
+</li>
+<li>
+<p>
+<code>advice.statusUoption=false</code> (see <a href="git-config.html">git-config(1)</a>):
+ setting this variable to <code>false</code> disables the warning message
+ given when enumerating untracked files takes more than 2
+ seconds. In a large project, it may take longer and the user
+ may have already accepted the trade off (e.g. using "-uno" may
+ not be an acceptable option for the user), in which case, there
+ is no point issuing the warning message, and in such a case,
+ disabling the warning may be the best.
+</p>
+</li>
+<li>
+<p>
+<code>core.untrackedCache=true</code> (see <a href="git-update-index.html">git-update-index(1)</a>):
+ enable the untracked cache feature and only search directories
+ that have been modified since the previous <code>git status</code> command.
+ Git remembers the set of untracked files within each directory
+ and assumes that if a directory has not been modified, then
+ the set of untracked files within has not changed. This is much
+ faster than enumerating the contents of every directory, but still
+ not without cost, because Git still has to search for the set of
+ modified directories. The untracked cache is stored in the
+ <code>.git/index</code> file. The reduced cost of searching for untracked
+ files is offset slightly by the increased size of the index and
+ the cost of keeping it up-to-date. That reduced search time is
+ usually worth the additional size.
+</p>
+</li>
+<li>
+<p>
+<code>core.untrackedCache=true</code> and <code>core.fsmonitor=true</code> or
+ <code>core.fsmonitor=&lt;hook_command_pathname&gt;</code> (see
+ <a href="git-update-index.html">git-update-index(1)</a>): enable both the untracked cache
+ and FSMonitor features and only search directories that have
+ been modified since the previous <code>git status</code> command. This
+ is faster than using just the untracked cache alone because
+ Git can also avoid searching for modified directories. Git
+ only has to enumerate the exact set of directories that have
+ changed recently. While the FSMonitor feature can be enabled
+ without the untracked cache, the benefits are greatly reduced
+ in that case.
+</p>
+</li>
+</ul></div>
+<div class="paragraph"><p>Note that after you turn on the untracked cache and/or FSMonitor
+features it may take a few <code>git status</code> commands for the various
+caches to warm up before you see improved command times. This is
+normal.</p></div>
+</div>
+</div>
+<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph"><p><a href="gitignore.html">gitignore(5)</a></p></div>
@@ -1377,7 +1451,7 @@ using <code>git --no-optional-locks status</code> (see <a href="git.html">git(1)
<div id="footer">
<div id="footer-text">
Last updated
- 2022-10-29 03:53:56 JST
+ 2022-12-19 12:03:12 JST
</div>
</div>
</body>