Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2013 Git -- Cannot complete the operation because of existing changes to the following file

Using VS 2013, I have made a change to a file, successfully committed and pushed to the server. When I go to change to a different branch, I get the following error:

Cannot switch to CM because there are uncommitted changes. Commit or undo your changes before you switch branches. See the Output window for details.

The output window of course shows the file I just committed and pushed. There are no files listed in the "Changes" area.

SourceTree shows no unstaged files and lets me change branches without a problem.

Any ideas?

like image 871
Lawrence Finch Avatar asked Mar 06 '15 20:03

Lawrence Finch


2 Answers

It sounds weird, but last time I got this error message, all I had to do was physically remove the conflicted file and click on the "clear all" button of the output window. Until I cleared the error message, the bug continued.

In my case however I was doing a Pull, but the error message was the same (system claims to be pending commits but the change window is empty).

like image 74
Sidney Benetti Avatar answered Oct 23 '22 22:10

Sidney Benetti


I tried the other two answers, no fix.

But here's what I tried that I believe made it reset itself in my case:

  • Find the offending file in Explorer
  • Rename it to remove its extension
  • Go back to VS, you'll find the Changes window shows the file with the rename action
  • Undo the rename change on that file

This should reset the state of the file and make it forget that there's a change on the file.
Now, you can simply switch or pull or do whatever was being blocked.

like image 39
BeemerGuy Avatar answered Oct 23 '22 21:10

BeemerGuy