如何在 Visual Studio 2013 中显示“git blame”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25076311/
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
How to show 'git blame' in Visual Studio 2013?
提问by Frank Kusters
In Visual Studio 2013 update 2 with Git integration, is there a way to show in the editor who last modified a line? (like the git blame
command?)
在带有 Git 集成的 Visual Studio 2013 更新 2 中,有没有办法在编辑器中显示最后修改一行的人?(比如git blame
命令?)
回答by DaveShaw
TFS (and so does VS) uses the Term "Annotate" instead of "Blame", just right click on the editor when you have a file open, then click Source Control, Annotate.
TFS(VS 也是如此)使用术语“Annotate”而不是“Blame”,只需在打开文件时右键单击编辑器,然后单击Source Control、Annotate。
I'm sure there are other ways to do it, either from the menu, toolbars, solution explorer, etc.
我确信还有其他方法可以做到,无论是从菜单、工具栏、解决方案资源管理器等。
回答by Usman
For Visual Studio Code (if you use that instead of Visual Studio 2013), try this extremely useful extension named: Git Lens: https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens
对于 Visual Studio Code(如果你使用它而不是 Visual Studio 2013),试试这个非常有用的扩展名为:Git Lens:https://marketplace.visualstudio.com/items?itemName =eamodio.gitlens
It will show who modified a line using an in-line to your code text like shown below:
Gone are the days of typing git blame <file-name
and then searching for the suspected line in whole code.
键入git blame <file-name
然后在整个代码中搜索可疑行的日子已经一去不复返了。
Update (10/17/2020): New version of Visual Studio Code (v1.38.0) shows who modified each line in bottom bar of the editor.You don't need Git Lens for this to work.
更新 (10/17/2020):新版本的 Visual Studio Code (v1.38.0) 显示了谁修改了编辑器底部栏中的每一行。您不需要 Git Lens 来执行此操作。