在 git diff 中自定义标题
当使用 git diff 查看差异时,每个更改都以如下行开头:
@@ -28,41 +20,10 @@ namespace ConsoleApplication1
对于 C,最后部分非常具有描述性 - 例如,它显示了发生更改的函数。但对于 C#,它只显示名称空间,这不是很有用。我认为这是因为它显示最后一行没有缩进。有没有办法如何配置这个?
When viewing a diff using git diff
, each change starts with line like:
@@ -28,41 +20,10 @@ namespace ConsoleApplication1
For C, the final part is quite descriptive – it shows for example the function in which the change occurred. But for C#, it only ever shows the namespace, which isn't very useful. I think that's because it shows last line that isn't indented. Is there a way how to configure this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了它,该行称为 hunk header ,文档说明了如何自定义它:
I have found it, the line is called hunk header and the documentation says how to customize it:
请参阅 gitattributes 手册页,“生成差异文本”部分,以及例如
diff.csharp .xfuncname
配置(搜索xfuncname
)。See gitattributes manpage, the "Generating diff text" section, and e.g.
diff.csharp.xfuncname
configuration (search forxfuncname
).