如何获取git-blame并登录以忽略换行更改? [英] How do I get git-blame and log to ignore line wrap changes?

查看:77
本文介绍了如何获取git-blame并登录以忽略换行更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个更改日志,以及一个怪异的注释,该注释会忽略换行中的更改.例如...

I would like a log of changes, and a blame annotation, which ignores changes in line wrapping. For example...

-This is the hardest part of testing, where do you start?  People often
-get overwhelmed at the apparent enormity of the task of testing a
-whole module.  Best place to start is at the beginning.  Date::ICal is
-an object-oriented module, and that means you start by making an
-object.  So we test C<new()>.
+This is the hardest part of testing, where do you start?  People often get
+overwhelmed at the apparent enormity of the task of testing a whole module.
+The best place to start is at the beginning.  C<Date::ICal> is an
+object-oriented module, and that means you start by making an object.  Test
+C<new()>.

几乎没有内容更改,但是日志和责备将显示所有更改.这既使补丁难以审核,也妨碍了检查代码寿命的工具.

There is very little content changed there, but the log and blame will show it all changed. This both makes patches difficult to review and gets in the way of tools which check the age of code.

-w 不够.

更新:答案只有一半: git log -p --word-diff 涵盖了日志记录.

UPDATE: I've got half the answer: git log -p --word-diff covers logging.

推荐答案

自git v1.4.3起,您可以使用diff选项-color-words 来显示内联更改,而忽略换行符,例如:

Since git v1.4.3 you can use the diff option --color-words to show inline changes, ignoring newlines, e.g.:

git log -p --color-words

从git 1.7.2开始,有一个更通用的-word-diff 选项,该选项还可以输出相似的内联diff,但以纯文本而不是颜色标记差异.

And since git 1.7.2 there is the more general --word-diff option, which also can output similar inline diffs but marking the differences in plain text rather than with colours.

据我所知, git blame 不能做这样的事情.

As far as I know you can't do anything like this with git blame.

这篇关于如何获取git-blame并登录以忽略换行更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆