title: Why do I get differences I can't get rid of when switching branches in git, and how to fix it?
body: <p>Here is some pertinent output from the command line (with poshgit showing the status):</p>
  
  <pre><code>[Branch1]&gt; git checkout Branch2
  Switched to branch 'Branch2'
  [Branch2 +0 ~3 -0]&gt; 
  [Branch2 +0 ~3 -0]&gt; git diff --ignore-space-at-eol
  [Branch2 +0 ~3 -0]&gt; git checkout .
  [Branch2 +0 ~3 -0]&gt;
  </code></pre>
  
  <p>I tried the solutions suggested in <a href="https://stackoverflow.com/questions/5237783/why-do-files-in-the-working-directory-get-the-modified-status-on-switching-betwe">this question</a></p>
  
  <pre><code>[Branch2 +0 ~3 -0]&gt; git reset --hard
  HEAD is now at c8be749 some comment
  [Branch2 +0 ~3 -0]&gt; git reset HEAD
  Unstaged another commit:
  M       Src/somefile
  M       Src/someotherfile.cs
  M       Src/athirdfile.cs
  [Branch2 +0 ~3 -0]&gt;
  </code></pre>
  
  <p>how does this happen and how can I fix it apart from committing the changes as I seem unable to undo the differences.  Even stashing does nothing.</p>
  
  <p>Some suggestions for how we got into this mess and how we can get out of it would be much appreciated.</p>
  
  <p>I have been able to reproduce this reliably now so am in a position to get a more definitive answer.  If I freshly clone me repo, then switch to a branch and then back to master I get some files which say they have changes.  I have tried playing with the settings of core.autocrlf but that just seems to change the number of files that are affected and doesn't solve the problem completely.</p>
  
  <p>What can I do to try and fix this increasingly annoying issue?</p>