git very slow with many ignored files
<p>I have set up a repository to include a working directory that has many tens of thousands of files, thousands of directories, with many Gb of data.  This directory is located on a samba share.  I only want to have a few dozen source files within this directory under version control.</p>

<p>I have set up the gitignore file thusly and it works:</p>

<pre><code># Ignore everything
*

# Except a couple of files in any directory
!*.pin
!*.bsh
!*/
</code></pre>

<p>Operations on the repository (such as commit) takes several minute to carry out.  This is too long to reasonably get any work done.  I suspect that the slowdown is because git is trawling through every directory looking for files that may have been updated.  </p>

<p>There are only a few locations in the working directory where I have files that I want to track, so I tried to narrow down the set of files to examine using this query:</p>

<pre><code>*
!/version_2/analysis/abcd.pin
!/version_2/analysis/*.bsh
!*/
</code></pre>

<p>This also works, but it is still just as slow as the less qualified gitignore.  I'm guessing it is that final line that is the killer, but no matter how I tried to make the unignore patterns be very specific, I always had to include that final wildcard clause in order for the process to find any files to commit.  </p>

<p>So my two part question is</p>

<p>1) Is there a better way to set up the gitignore file that will help speed up the commit process by only including the very narrow set of directories and file types that contain relevant results?</p>

<p>2) Is there some other tweaks to git or samba that are required to make this work more efficiently?</p>

<p>Thanks,</p>

<p>Tom</p>