简体   繁体   English

Visual Studio 2019 中的 Git 作者信息

[英]Git author information in Visual Studio 2019

I use Visual Studio 2019 and I am missing a feature I can't find in the settings.我使用 Visual Studio 2019,但缺少在设置中找不到的功能。 In Visual Studio Code , once I open a project that is under git control, I see an author and commit info of the line the text cursor is currently located in. If I open the same project in Visual Studio 2019 this functionality does not appear.Visual Studio Code 中,一旦我打开一个受 git 控制的项目,我就会看到文本光标当前所在行的作者和提交信息。如果我在Visual Studio 2019 中打开同一个项目,则不会出现此功能。

I am looking for the info between line 8-9:我正在寻找第 8-9 行之间的信息: 在此处输入图片说明

Is there any option to active that feature from VS Code in VS 2019 as well?在 VS 2019 中是否也有任何选项可以从 VS Code 中激活该功能? Any help is highly appreciated!任何帮助表示高度赞赏!

If you want source control history at the method level, enable CodeLens .如果您需要方法级别的源代码控制历史记录,请启用CodeLens Note that the 2019 community version of Visual Studio does not include this feature.请注意,2019 社区版 Visual Studio 不包含此功能。

If you want source control history at the per-line level, in your text editor, right click > Source Control > Blame (Annotate):如果您需要每行级别的源代码管理历史记录,请在文本编辑器中,右键单击 > 源代码管理 > 责备(注释):

Visual Studio 责备(注释)

Author and commit ( git blame ) info will be displayed for each line:将为每一行显示作者和提交( git blame )信息:

Visual Studio 注释

For quicker access, add a shortcut for the command "Team.Git.Annotate".为了更快地访问,请为命令“Team.Git.Annotate” 添加快捷方式

In Visual Studio Professional 2019 using GIT as source control you should be able to right click in the file and select Git > Blame(Annotated) to view line annotations with author, date and a unique commit identifier.在使用 GIT 作为源代码管理的 Visual Studio Professional 2019 中,您应该能够右键单击文件并选择 Git > Blame(Annotated) 以查看带有作者、日期和唯一提交标识符的行注释。

Clicking the commit id will bring up the change set so you can review all of the changes associated with the line(s) in question as well as any comments for the commit.单击提交 ID 将显示更改集,因此您可以查看与相关行相关的所有更改以及对提交的任何评论。

It threw me off because a person might think to right click in the file and select Annotation > Show Line Annotations which did not seem to work for me.它让我失望,因为有人可能认为右键单击文件并选择注释 > 显示行注释,这似乎对我不起作用。

I was recently checking out other Source Control options (Perforce and Plastic SCM), and then noticed I too had lost my Git ▸ Blame option in VS.我最近正在检查其他源代码控制选项(Perforce 和 Plastic SCM),然后注意到我在 VS 中也丢失了我的 Git ▸ Blame 选项。 Turned out the Plug-in Selection was no longer set to Git, so make sure it is on inside of Tools ▸ Options.结果发现插件选择不再设置为 Git,因此请确保它位于工具 ▸ 选项中。 源代码管理设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM