如何使用 - 使用git添加色彩词--patch? [英] How to use --color-words with git add --patch?
问题描述
在区分文件时,我更喜欢使用 git diff --color-words
。使用 git add --patch
或 git add --interactive
建立VonC所说的话:
使用Git 2.9,你可以使用这个命令在 add --patch
中添加颜色:
git -c interactive.diffFilter =git diff --color-wordsadd -p
这会为 您可以轻松地为此命令添加别名,如下所示: When diffing files, I prefer to use Building off of what VonC said: Starting with Git 2.9, you can use this command to color words during This sets the You can easily add an alias for this command like so:
这篇关于如何使用 - 使用git添加色彩词--patch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! add -p
调用设置 interactive.diffFilter
变量,而不会影响其他调用。对我来说这是理想的,因为我通常希望正常运行 add -p
,但有时候想用 - color-words $运行它c $ c $。
git config --global alias.addcw'-c interactive.diffFilter =git diff --color-wordsadd -p'
git diff --color-words
. Is there a way to make this the default format for diffs when using git add --patch
or git add --interactive
?add --patch
:git -c interactive.diffFilter="git diff --color-words" add -p
interactive.diffFilter
variable for the call to add -p
without affecting further calls. For me this is ideal because I usually want to run add -p
normally, but sometimes want to run it with --color-words
.git config --global alias.addcw '-c interactive.diffFilter="git diff --color-words" add -p'