TFS/GIT in VS Cannot switch to master because ther

2019-02-01 05:56发布

I've setup a GIT repository for a VS 2013 solution on visualstudio.com. The repository worked great while I was becoming accustomed to using TFS (in GIT mode).

Then I decided to familiarize myself with Branches, so I created a branch off of the master. I've made quite a few changes in this branch. I've committed the changes over time and have performed a Sync to push my local commits to the visualstudio.com repository. This all works.

The problem I am having is that I somehow lost the ability of switching back to the master branch. I cannot merge my newly created branch into the master. Every time I try to do anything that involves the master I get the following error in VS:

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

The Output window never contains any 'details'...

What "uncommitted changes" does this message refer to? Since I cannot get into the master branch I have no way of committing any of its changes (nor am I sure that I want to?). And the current (only other) branch I am in has been committed and sync'ed.

I'm really just learning TFS, GIT and source control. How do I safely recover from this problem?

13条回答
贼婆χ
2楼-- · 2019-02-01 06:29

The problem is that sometimes after pull path to some files do not match their equivalent in repository database because comparison is case-sensetive.

For example, you could have "MyLibrary\ABC\Folder\MyFile.cs" in repository but "MyLibrary\Abc\Folder\MyFile.cs" on the disk. There will be no changes detected in "git status" but Visual Studio will block branch switch.

Deleting just MyFile.cs from disk in that case will not solve the problem - you'll need to delete ABC directory and then undo changes for Visual Studio to recreate folder structure with correct names.

查看更多
登录 后发表回答