在提交/推送到 TFS 之前,是否可以在 Visual Studio 中查看您的更改?(Git Diff 的 GUI)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29131503/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:01:55  来源:igfitidea点击:

Is it possible to see what your changed in Visual Studio before you commit/push it to TFS? (Gui of Git Diff)

gitvisual-studiotfsdiff

提问by Frank Visaggio

Using TFS-2013 with a project that is using git, is it possible to see the changes I made in Visual Studio 2013 Pro before I commit them? If so how?

将 TFS-2013 与使用 git 的项目一起使用,是否可以在提交之前查看我在 Visual Studio 2013 Pro 中所做的更改?如果是这样怎么办?

Ie lets say I have /project

即可以说我有 /project

and i change line 32 of /project /foo.js

我更改了 /project /foo.js 的第 32 行

Is there a way It will show me what i changed on that line

有没有办法它会告诉我我在那条线上改变了什么

In short I guess is there a visual way to do a Git Diff in visual studioI could just use Meld like i do on linux but there must be a good way to do this without leaving VS.

简而言之,我想是否有一种可视化的方法可以在 Visual Studio 中进行 Git Diff,我可以像在 linux 上一样使用 Meld,但必须有一种在不离开 VS 的情况下执行此操作的好方法。

Microsoft Tools for Git looks awesome but its only for VS2012. Is there a main repo where I can find a similar plugin for 2013?

Microsoft Tools for Git 看起来很棒,但它仅适用于 VS2012。是否有一个主存储库,我可以在其中找到 2013 年的类似插件?

回答by jessehouwing

Visual Studio 2013 has a built-in Git version control client.You'll find it on the "Team Explorer", at the bottom of the list of TFS projects. If you already have a local Git repository, simply add it using the addoption. If you have access to a remote repository, but have not yet cloned it locally, you can clone it using the, you guessed it, cloneoption.

Visual Studio 2013 有一个内置的 Git 版本控制客户端。您可以在 TFS 项目列表底部的“团队资源管理器”中找到它。如果您已经有一个本地 Git 存储库,只需使用该add选项添加它。如果您有权访问远程存储库,但尚未在本地克隆它,则可以使用您猜对了的clone选项进行克隆。

enter image description here

在此处输入图片说明

It should not be needed, but you may have to tell Visual Studio to turn on the "Visual Studio Git" provider or the "Team Foundation Server" provider. If you have other source control providers installed, like SourceSafe or SubVersion, they may hide this feature. To switch the source control provider, look under: Tools- Options- Source control- Plug-in Selection:

它应该不是必需的,但您可能必须告诉 Visual Studio 打开“Visual Studio Git”提供程序或“Team Foundation Server”提供程序。如果您安装了其他源代码控制提供程序,如 SourceSafe 或 SubVersion,它们可能会隐藏此功能。要切换源代码管理提供程序,请查看: Tools- Options- Source control- Plug-in Selection

enter image description here

在此处输入图片说明

Visual Studio 2013 (as well as 2012) only support the httpand httpsprotocol to interact with a remote repository. ssh:and git:are not supported.

Visual Studio 2013(以及 2012)仅支持httphttps协议与远程存储库交互。ssh:并且git:不受支持。

In the solution Explorer you can compare your current version to Unmodified:

在解决方案资源管理器中,您可以将当前版本与未修改版本进行比较:

enter image description here

在此处输入图片说明

The Git Diff Marginplugin provides additional information on local changes in the gutter of your source file:

git的差异保证金插件提供了对源文件的装订线的局部变化的更多信息:

enter image description here

在此处输入图片说明

And the Visual Studio 2013 ultimate feature "CodeLens" shows previous commits in the UI as well at the class and method level:

Visual Studio 2013 终极功能“CodeLens”在 UI 以及类和方法级别显示以前的提交:

enter image description here

在此处输入图片说明

See also:

也可以看看: