【问题标题】:GIT integration to show method history in Visual StudioGIT 集成以在 Visual Studio 中显示方法历史记录
【发布时间】:2017-01-17 02:44:40
【问题描述】:

我们使用 GitHub 作为源代码存储库,使用 Visual Studio 进行开发 (C#)。我从 Visual Studio 专业版(试用版)降级到社区版,不知何故丢失了我在每个方法签名上方的 GIT 方法历史记录。我已经重新安装了专业版,但仍然看不到它。这个方法历史非常有用,看起来像:

Last Update 8/1/2015, 3 authors.
Void DoSomething() {}

点击状态栏会显示“与以前的版本比较”、历史记录等内容。

我不确定它是 Visual Studio Professional 的一项功能(可疑)还是我可能安装的 git 扩展之一(请参阅工具->扩展和更新)或其他东西。我是使用 GIT/GitHub 的新手,尤其是使用 Visual Studio,希望能得到一些帮助。我的具体问题

1.  How do I get history/last author/etc for each method (not file)?  Does it work under Professional and Community
2.  What are some good Git Tools to install in Visual Studio to see changes/history, etc.?  I'm using the command line to commit/push etc., but am not opposed to doing this from Visual Studio if it makes sense.

谢谢,

戴夫

【问题讨论】:

    标签: c# git visual-studio github


    【解决方案1】:

    您最初指的是 Visual Studio 的一项功能,称为 CodeLens。它在 Visual Studio 2015 的专业版和企业版中可用,但在社区版中不可用。

    要尝试解决此问题,我会:

    1. 确保您实际运行的是 Visual Studio 2015 专业版,而不是社区版。

    2. 确保您已安装Git for Windows

    【讨论】:

    • 谢谢史蒂夫。感谢您参考 CodeLens。即使我怀疑它,也没有确定该功能不在社区版中。我不得不做另一个修复(见我的回答),但你的建议让我大部分时间都得到了解决。问候,戴夫
    • Visual Studio 不需要 Git for Windows。 2015 年,它使用自己的独立 git 实现(并在 2017 年安装了自己的 Windows 版 Git)。
    • 谢谢爱德华。在为 Windows 安装 Git 之后,我似乎无法恢复我的方法历史记录。但也许是清除缓存(请参阅我的回答)。无论如何,它现在正在工作,我不倾向于进行更多实验:) CodeLens 信息的链接对我来说非常宝贵。
    • @EdwardThomson 我认为 Visual Studio 2015 实际使用或安装了适用于 Windows 的 Git - 例如将 Git for Windows v2.x.x 安装为独立版本,然后在 Visual Studio 2015 安装期间,Git for Windows [3rd Party]“功能”是“已在您的系统上找到...不会采取任何操作”。选择Git for Windows [3rd Party] 功能时,Visual Studio 2015 安装程序是否真的安装了私有实现?
    • @Steve VS 2015 确实安装了适用于 Windows 的 Git,但那是因为它试图对您有所帮助,而不是因为它是对 git 支持的要求。 VS 2013 和 2015 使用 LibGit2Sharp 与存储库对话。 (我不记得这种行为是在 RTM 中还是在季度更新中是新的。)这真的只是一些琐事,真的 - 我看到了你的回答,并想我会提到它。 :D
    【解决方案2】:

    除了史蒂夫的出色回答(我将其标记为答案)之外,我会注意到我还有其他问题(在为 Windows 安装 Git 之后)。

    我在启动时遇到错误,没有看到方法信息。错误是: “GitCollaborationPackage”包未正确加载。 “FileIndicatorPackage”包未正确加载。

    修复方法是重命名 C:\Users\cshar\AppData\Local\Microsoft\VisualStudio\14.0 下的 componentmodelcache 目录

    见: Packages not loading after installing visual studio 2015 RTM 或者 http://kuebiko.blogspot.ru/2013/07/setsite-failed-for-package.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-13
      • 2016-10-20
      • 1970-01-01
      • 1970-01-01
      • 2011-06-06
      • 2021-10-19
      • 2019-10-22
      • 1970-01-01
      相关资源
      最近更新 更多