[英]`git commit -p`: can I get better diff, per chars?
In such cases: 在这种情况下: it is difficult to say - here was changed the indentation only or maybe also my cat updated a few chars. 很难说-这里只是更改了缩进,或者也许我的猫也更新了一些字符。 I know that exists for example diff-so-fancy where I can see the difference on the chars level, but there is no official out of the box solution? 我知道存在diff-so-fancy这样的地方,在这里我可以看到chars级别的区别,但是没有官方的开箱即用解决方案吗?
You can use git diff
directly. 您可以直接使用git diff
。 It does have options for whitespace handling. 它确实具有空白处理选项。 -> man git-diff
-> man git-diff
You are looking for the --word-diff
option. 您正在寻找--word-diff
选项。
For the file 对于文件
The quick brown fox jumps over the lazy dog
changed to 变成
The quick brown fox jumps over the sleepy dog
git diff --word-diff
shows git diff --word-diff
显示
The quick brown fox jumps over the [-lazy-]{+sleepy+} dog
EDIT: Oh, I realized that your problem is the very long URL that is treated as a single word. 编辑:哦,我意识到您的问题是被视为一个单词的非常长的URL。 --word-diff-regex may help here. --word-diff-regex在这里可能会有所帮助。
I tried a different, but similar URL with git diff --word-diff-regex="/|[^[:space:]]"
, which worked quite well. 我用git diff --word-diff-regex="/|[^[:space:]]"
尝试了一个不同但相似的URL,效果很好。 You might however want to improve that regex. 但是,您可能需要改进该正则表达式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.