Visual Studio 2015 Git error message "Cannot pull/switch because there are uncommitted changes"
<p>I am having difficulty in doing a pull from <code>origin</code>. I keep getting:</p>

<blockquote>
  <p>"Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details."</p>
</blockquote>

<p>This also applies to switching branches. I get a similar sort of message, but this does not always happen.</p>

<p>I am using Visual Studio 2015 Update 1 and Visual Studio Team Services Git. On my machine I have a local <code>master</code> branch, and development branches. Every time I switch to <code>master</code> and then I do a pull I get the error message. I have resorted to doing a stash and drop stash (command line) and sometimes I use <a href="http://en.wikipedia.org/wiki/TortoiseGit" rel="noreferrer">TortoiseGit</a> to do the pull and it works.</p>

<p>What is strange is even if I try to revert (on the uncommitted files) using TortoiseGit it shows that it was reverted successfully (I have already tried Visual Studio undo, nothing happens). Trying to pull again, it is still the same problem. The uncommitted files will be there and sometimes when I do a <code>git status</code> it says there is nothing to commit.</p>

<p>Just a note: This can happen even after switching from a branch onto <code>master</code>. In this case there is no way there can be uncommitted changes, because I would not have been able to switch in the first place.</p>

<p>I am still new to Git, but I would like to know if there is a better way of solving this as I would like to use one environment instead of using switching between different environments for each task; it's easier for me to just do everything from Visual Studio. I have already read up on:</p>

<p><em><a href="https://stackoverflow.com/questions/26885057/tfs-git-in-vs-cannot-switch-to-master-because-there-are-uncommitted-changes">TFS/GIT in VS Cannot switch to master because there are uncommitted changes</a></em></p>

<p><strong>UPDATE</strong></p>

<p>It seems like this problem has to do with line endings.</p>

<p>By doing a <code>git diff -R</code> you can see that a line ending has been added, "^M", and it is different. Removing the <code>* text=auto</code> in gitattributes (then check for changes) and putting it back on again so that the gitattributes does not signal a change of itself that needs to be committed seems to help, there will not be any changes.</p>