简体   繁体   English

git log显示添加/删除-有没有办法显示修改后的行

[英]git log shows added / removed - is there a way to show modified lines

When we use the $ git log command, we can see how many lines added / removed for a file. 当我们使用$ git log命令时,我们可以看到为一个文件添加/删除了多少行。

My question is - is there a way to inspect which lines were modified (neither added nor removed)? 我的问题是-有没有办法检查修改了哪些行(既没有添加也没有删除)? Or can only git diff do that? 还是只有git diff做到这一点?

Sort of a philosophical question, since a modified line could simply be considered to be removed then added. 这是一个哲学问题,因为修改后的行可以简单地认为是先删除再添加。

Currently, when this answer is written, git doesn't have any option to display line numbers and content which was modified in any way. 当前,在编写此答案时,git没有任何选项来显示以任何方式修改的行号和内容。

What you need to do is to write a script for this purpose. 为此,您需要编写一个脚本。
The following answer supplies you with such a script: 以下答案为您提供了这样的脚本:

Using git diff, how can I get added and modified lines numbers? 使用git diff,如何获得添加和修改的行号?

看起来您正在寻找的东西可以使用git diff --color-words选项来实现。

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

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