title: git line endings - can't stash, reset and now can't rebase over spurious line endings commit
body: <p>I have a repo I  added a <code>gitattributes</code> to it and was working on it fine. I sync it via dropbox to another machine. When I opened it to the other machine a bunch of files <strong>suddenly appeared</strong> on the unstaged area as total diffs (all the file a huge diff which means line endings diff) - my crlf endings are basically <code>.* text=auto</code> and I am working on windows. I tried to stash the changes, reset the branch etc. At long last I decided to commit the files and then made some other commits I wanted to reorder (and squash) before the line endings commit. When I try rebasing I get a :</p>
  
  <pre><code>error: Your local changes to the following files would be overwritten by merge
          # those same files
  Please, commit your changes or stash them before you can merge.
  Aborting
  Could not apply 89b25b81fff1a1e7893319e123aaaca9c4162a95... &lt;commit message&gt;
  </code></pre>
  
  <p>Of course stash does not work</p>
  
  <p>Is it a bug ?</p>
  
  <p>Related:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/1577458/how-do-i-fix-line-ending-issues-after-migrating-from-svn-to-git">How do I fix line ending issues after migrating from SVN to git?</a> (yes mine is a git-svn clone, but I do not think it is really important)</li>
  <li><a href="https://stackoverflow.com/questions/1575682/cant-seem-to-discard-changes-in-git">Can&#39;t seem to discard changes in Git</a> (yep and I want to know <strong><em>why</em></strong>)</li>
  <li><a href="https://stackoverflow.com/questions/10890380/git-thinks-files-have-changed/11258263">git thinks files have changed</a></li>
  <li><a href="https://stackoverflow.com/questions/23266990/can-someone-explain-to-me-what-difference-git-diff-is-seeing-here">Can someone explain to me what difference git diff is seeing here?</a></li>
  </ul>
  
  <p><strong>EDIT</strong> Nothing to do with machines - on the same machine some (...) operations just make those files (they are on the <code>.gitattributes</code> as text) appear in the "changed" section. The only workaround that seems to exist is:</p>
  
  <pre><code>git rm --cached -r .
  git reset --hard
  </code></pre>
  
  <p>USE CAREFULLY</p>
  
  <p>EDIT: hack above moved to alias status:</p>
  
  <pre><code>[alias]
       crlf = !git rm -r . --cached -q &amp;&amp; git reset --hard
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE 2015.09.30</strong>: I have a git repo in an NTFS partition I use from windows 7 and arch linux in a dual boot environment. When I shut windows down and I boot into arch two files (html) show as total diffs (line ending diffs). The above workaround does not work - unless you apply it several times refreshing the gui in between...</p>
  
  <p>My <code>.gitattributes</code>:</p>
  
  <pre><code>* text=auto
  
  *.py text diff=python
  *.html text
  .project text
  *.pkl -text
  
  # M$ files
  *.bat text eol=crlf
  
  # UNIX files
  **/generate_second_post text eol=lf
  
  # git files - have them with LF, as I edit them via the shell (echo etc)
  *.gitignore text eol=lf
  *.gitattributes text eol=lf
  </code></pre>
  
  <p><strong>NB</strong>: linux will let me commit, switch branches etc but won't let me rebase - plus those diffs always appear in gitk/git gui.</p>
  
  <p><strong>2018/12/14</strong> moved to mac and my workaround does not work anymore. I posted a message to the git mailing list: <a href="https://marc.info/?l=git&amp;m=154482149623324&amp;w=2" rel="noreferrer">https://marc.info/?l=git&amp;m=154482149623324&amp;w=2</a></p>
  
  <p>Let's hope this will get some attention</p>
  
  <pre><code>$ git --version
  git version 2.19.2
  </code></pre>