title: Git Checkout errors
body: <p>I am using a script to automatically checkout the first commit of each month, for the last 12 months.  Occasionally something strange happens and I am no longer allowed to checkout past commits.  The error goes something like this:</p>
  
  <p><code>error: Your local changes to the following files wold be overwritten by checkout:</code></p>
  
  <p><code>db tests/framework.cpp</code></p>
  
  <p><code>Please, commit your changes or stash them before you can switch branches.  Aborting</code></p>
  
  <p>This has happened many times (I am not editing any files, just checking them out). I usually just download a fresh copy of the repo from Github and start the process again and it works.  But once it breaks I don't know how to fix it, and it keeps happening.  Any thoughts?</p>
  
  <p>Here is the iteration going on in my script, followed by the output of <code>git status</code></p>
  
  <pre><code>for i in {12..1}
  
  do
  
  cd
  cd git/mongodb/mongo
  
  git checkout master                   
  git checkout $(git rev-list --before "$(date -d "$(date +%Y-%m-01) -$i months 00:01" +%Y-%m)-01" -n 1 HEAD)
  git checkout master
  </code></pre>
  
  <p>Git status:</p>
  
  <p>On branch master</p>
  
  <p>Changes not staged for commit:</p>
  
  <pre><code>        modified:    dbtests/framework.cpp
  </code></pre>
  
  <p>Untracked files:</p>
  
  <pre><code>       SHA1.txt
         SHA1.txt.
         file
         file.
  </code></pre>
  
  <p>no changes added to commit </p>