title: How (and how often) does Git scan the working directory for "untracked" files?
body: <p>Once you run git init on a directory, git knows about all files that exist in that directory and below. These are untracked files. I'm familiar enough (ish) with what happens when you stage those files and they become &quot;tracked&quot; files. But what I want to know is, how does Git find the untracked files? Does git run the tree command every few minutes or on fixed intervals? Does it run the tree command every time you type git status, or git add? Or every time you save a file? Is something cleverer going on?</p>
  <p>So my questions in short:</p>
  <ol>
  <li><p>How does Git find the untracked files?</p>
  </li>
  <li><p>How often does Git search for &quot;untracked&quot; files?</p>
  </li>
  </ol>