3

For Example, I just started visual studio to find 28 changes to files I've never even opened. When I try to undo the changes (right clicking and selecting undo), I get a dialog box to confirm. I click yes, and then nothing happens.

A colleague of mine says this happens to him sometimes and he hasn't found a solution outside of starting over. Since that's so unsatisfying, does anyone else know why this is happening, or how to fix it?

I'm using Visual Studio 2015 on Windows 10

jemtan990
  • 443
  • 1
  • 6
  • 22
  • Tell me about your line endings. – Edward Thomson Jul 22 '16 at 20:19
  • I'm not sure how to find the details on that, but I'd be glad to! Also, that thought occurred to me, but why would it pick 28 random files to change the line endings on? I hadn't even opened any of them. – jemtan990 Jul 22 '16 at 20:25
  • 1
    Do you have a `.gitattributes`? Do you have `core.autocrlf` set to something? Have you read https://help.github.com/articles/dealing-with-line-endings/ ? – Edward Thomson Jul 22 '16 at 20:43
  • Hey, sorry I didn't notice your comment sooner! Yes, I looked into the line endings. That's definitely the problem with all of the changed files. My issue now is that I can't undo those changes. I see now how to go forward without running into this again (hopefully), but how do I fix the issue at hand? Any ideas? – jemtan990 Jul 25 '16 at 19:49
  • 1
    Yes, this is another long term non solved problem. I have not see this problem with git, but often with TFS. Answers are often ask about line endings. HEY! Problem is not with line endings. Problem is with VS comparer error, which does not know manage this problem. This is a few lines of code to repair this problem, but Microsoft rather add EMOJI to Windows. This problem is in VS 2019 too, and even if all line endings are created in VS, without changing VS options. – bmi Sep 08 '20 at 06:25

1 Answers1

2

Just as Edward Thomson commented,it's probably a line ending issue.

You could run git diff -w command to verify what is really changed in files to understand if you really have a Line Ending Issue.

The -w options tells git to ignore whitespace and line endings, if this command shows no differences, you are probably victim of problem in Line Ending Normalization.

Detail solution please check this blog: Git showing file as modified even if it is unchanged

Also take a look at this question in Stackoverflow: Trying to fix line-endings with git filter-branch, but having no luck


Update

To undo the pending changes, try to use below workaround, open the solution in VS2013 and undo the pending changes in the Team Explorer with VS2013. Finally reopen it in VS2015. The pending changes will go away.

Details please refer a similar question in MSDN: VS2015 and TFS Git – can’t undo changes

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • You're right, the git diff -w shows no changes where just git diff does. That's frustrating, but thanks for the info! – jemtan990 Jul 25 '16 at 12:55
  • @jemtan990 Try to use **GIT command** such as this link http://stackoverflow.com/questions/14075581/git-undo-all-uncommitted-changes mentioned and you can also try to undo the pending changes in VS2013, more details please see my update answer. – PatrickLu-MSFT Jul 26 '16 at 03:01
  • Using VS2013 seemed to have worked, but when I opened it up again in 2015, even more changes were added. The reference in MSDN was more effective, but opening in 2015 again added 5 new changes. It seems like every time I think I've made a real change, either in bash, the gui, tortoise, etc, VS2015 finds a way to keep adding. – jemtan990 Jul 26 '16 at 12:43