visual-studio-2013 - Visual Studio TFS Git 没有看到任何变化

标签 visual-studio-2013 tfs

我没有得到有关 Visual Studio 的 Git for TFS 的任何信息。

我在 TFS 上的 Git 中克隆了同事的解决方案,并开始添加代码。然后我意识到我需要自己的分支来进行更改,因此请按照 Push a new local branch to a remote Git repo and track it too 中的说明进行操作。我跑了

git checkout -b e4ctim
git push -u origin e4ctim

当我对代码进行更改时, Visual Studio 会在代码文件旁边显示熟悉的红色勾号图标,以向我保证更改已触发要 checkout 的文件:

VS red-tick

然后,当我保存文件时,Visual Studio 将图标返回到蓝色挂锁。我认为从红色勾号到蓝色挂锁的更改表示该更改已在 Git 中本地 checkin :

VS blue-lock

但是当我查看修改文件的历史记录时,没有!

No history

我想在本地提交更改并将其与 TFS 服务器同步。

Visual Studio 根本看不到任何变化:

VS TFS Changes

从命令行我可以看到 Git 已经通过运行命令注意到了我的所有修改

git status

并看到许多未针对提交和未跟踪文件进行的更改。

git status cmd

寻找Git book我可以使用

git add

或更具体地说

git add -u .

准备提交文件,但我不愿意这样做,因为 Develop your app in a Git repository (track, commit) Visual Studio 文档指出:

Q: Where is the Git stage?
A: If you are an experienced Git user, you might have noticed that Visual Studio handles changes differently than the command prompt. You might have wondered if the Included Changes section contains your staged changes. In fact, Visual Studio usually bypasses the Git stage for you. When you commit changes, Visual Studio simultaneously stages and commits them. The one exception occurs when you add a file to your Git repository; Visual Studio does stage this kind of change.

Visual Studio 同时暂存和提交更改。但为什么它没有将我对跟踪文件所做的任何修改列为更改,从而让我提交它们?

最佳答案

这更多的是一种解决方法而不是解释,但我发现如果我忽略the documentation “当您提交更改时,Visual Studio 同时暂存并提交它们”,而是使用命令将修改添加到暂存

git add -u .

然后 Visual Studio 突然意识到这些修改,让我在本地提交它们并将它们与 TFS 服务器同步。此外,它然后将“新文件”绿色十字放在我添加的文件上,我发现我可以进行另一次提交,然后进行另一次同步以获取我所做的添加和删除。

从那时起,Visual Studio 就按照我的预期进行了操作:当我对文件进行更改时,该文件将在提交窗口中列为已更改。

我仍然不知道为什么 Visual Studio 直到初始 git add 之后才接受更改,但至少现在可以工作了。

关于visual-studio-2013 - Visual Studio TFS Git 没有看到任何变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28454746/

相关文章:

azure - 如何从 One VS 解决方案发布两个单独的 Azure 网站

c# - 列表框无法显示子类变量

user-interface - Visual Studio 2013 : What do the number suffixes in the file tabs mean?

html - 在没有标题栏的情况下在 mfc c++ 中移动窗口?

c# - 通过数据仓库以编程方式检索 TFS "instrumented binaries"的路径信息

eclipse - Team Explorer Everywhere 无法自动合并冲突,并且无法在 Eclipse 中显示解决冲突屏幕

c++ - visual studio 2013 发布编译不打开文件

带有 CMake 错误的 OpenCV 构建

tfs - 没有目标分支的源代码管理合并向导

visual-studio - Program.cs 已隐藏