VS中的TFS / GIT由于存在未提交的更改,因此无法切换到主站 [英] TFS/GIT in VS Cannot switch to master because there are uncommitted changes

查看:756
本文介绍了VS中的TFS / GIT由于存在未提交的更改,因此无法切换到主站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在visualstudio.com上为VS 2013解决方案设置了GIT存储库。当我习惯于使用TFS(在GIT模式下)时,资源库运行良好。

然后我决定熟悉分支,所以我创建了一个分支主。我在这个分支做了很多改变。我已经提交了一段时间的更改,并执行了一次Sync以将我的本地提交推送到visualstudio.com存储库。这一切都奏效。



我遇到的问题是我以某种方式失去了切换回主分支的能力。我无法将我新创建的分支合并到主设备中。每次我尝试做任何涉及主人的事情时,我都会在VS中遇到以下错误:


无法切换到主人,因为有未提交的更改。在切换分支之前提交或撤消更改。输出窗口从不包含任何详细信息...




这条消息提到什么未提交的更改?由于我无法进入主分支,因此我无法提交任何更改(我也不确定我想要吗?)。我现在所在的(只有其他)分支已经提交并同步了。

我真的只是在学习TFS,GIT和源代码控制。我该如何安全地从这个问题中恢复?

解决方案

好的,我自己和rwkiii有同样的问题 - Visual Studio并不是一个容易解决的问题。这里是症状:



Visual Studio声明您不能合并/切换braches / etc。因为您有未提交的更改 - 这很好,除了所有更改已被提交。


无法切换到主人,因为有未提交的变化。在切换分支之前提交或撤消更改。详情请参阅输出窗口。


这里是一个截图,更清晰。



如果你看看输出窗口,它可能看起来是空的,但你必须改变显示输出到源代码控制 - Git。这将列出Visual Studio 认为发生了变化的文件。



现在,我试过的东西没有修复它(所以你不必):




  • 重新启动Visual Studio

  • 重新启动机器

  • 切换项目

  • 使用外部git工具(所有这些工具都显示没有更改)
  • git reset

  • 对文件进行任意更改并提交。承诺没问题,VS仍然认为还有更多变化



最后,我必须去删除文件,然后从团队资源管理器窗口中撤消: .pngalt =点击撤销恢复文件和切换分支的能力>



不是最理想的解决方案,但它确实似乎修复它。


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?

解决方案

Okay, I had the same issue myself as rwkiii - this is a bug in Visual studio and is not an easy one to fix. Here are the symptoms:

Visual Studio states that you cannot merge/switch braches/etc. because you have uncommitted changes - which is fine, except all your changes have been committed.

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

Here's a screenshot to be clearer.

If you look at the output window, it may appear empty but you have to change "Show output from" to "Source Control - Git". This will list the file that Visual Studio thinks has changes.

Now, things that I tried that didn't fix it (so you don't have to):

  • Restarting Visual Studio
  • Restarting the machine
  • Switching Projects
  • Using external git tools (All of which said "no changes")
  • git reset
  • Making arbitrary changes to the file and committing that. Commits ok, VS still thinks there's more changes

In the end, I had to go and delete the file from the disk, then "undo" that change from the Team Explorer window:

Not the most ideal solution, but it does seem to fix it.

这篇关于VS中的TFS / GIT由于存在未提交的更改,因此无法切换到主站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆