git 文件差异中这些红色条的含义是什么
What is the meaning of these red bars in git file difference
+ 号后有一个红色条。这是什么?
这意味着您的源代码中有不需要的额外空格。您应该删除那些不需要的空间以保持清洁。
可能有错误的缩进。您可能在将 Git 配置为首选空格时使用了制表符,或者 vice-versa.
勾选git config core.whitespace
;它可能包含 tab-in-indent
、space-before-tab
或 indent-with-non-tab
。如果这不是真的错误,您应该根据自己的喜好进行更改。
以下是 core.whitespace
.
的可能值
您的配置值将是以下选项卡值之一
core.whitespace
A comma separated list of common whitespace problems to notice.
git diff will use color.diff.whitespace
to highlight them, and git apply
--whitespace=error
will consider them as errors.
You can prefix - to disable any of them (e.g. -trailing-space):
blank-at-eol
将行尾的尾随白色space视为错误(默认启用)。
space-before-tab###
将紧接在行的初始缩进部分中的制表符之前出现的 space 字符视为错误(默认启用)。
indent-with-non-tab
将缩进 space 个字符而不是等效制表符的行视为错误(默认情况下未启用)。
tab-in-indent
将行首缩进部分的制表符视为错误(默认未启用)。
blank-at-eof
将在文件末尾添加的空行视为错误(默认启用)。
trailing-space
a short-hand 涵盖 blank-at-eol
和 blank-at-eof
。
cr-at-eol
将行尾的 carriage-return 视为行终止符的一部分,也就是说,如果 carriage-return 之前的字符不是白色space(默认不启用)。
tabwidth=n
表示制表符占据多少个字符位置;这与 indent-with-non-tab 相关,当 Git 修复 tab-in-indent 错误时。默认制表符宽度为 8。允许的值为 1 到 63。
选项卡用作配置值时的输出示例:
+ 号后有一个红色条。这是什么?
这意味着您的源代码中有不需要的额外空格。您应该删除那些不需要的空间以保持清洁。
可能有错误的缩进。您可能在将 Git 配置为首选空格时使用了制表符,或者 vice-versa.
勾选git config core.whitespace
;它可能包含 tab-in-indent
、space-before-tab
或 indent-with-non-tab
。如果这不是真的错误,您应该根据自己的喜好进行更改。
以下是 core.whitespace
.
的可能值
您的配置值将是以下选项卡值之一
core.whitespace
A comma separated list of common whitespace problems to notice.
git diff will usecolor.diff.whitespace
to highlight them, and git apply
--whitespace=error
will consider them as errors.
You can prefix - to disable any of them (e.g. -trailing-space):
blank-at-eol
将行尾的尾随白色space视为错误(默认启用)。
space-before-tab###
将紧接在行的初始缩进部分中的制表符之前出现的 space 字符视为错误(默认启用)。
indent-with-non-tab
将缩进 space 个字符而不是等效制表符的行视为错误(默认情况下未启用)。
tab-in-indent
将行首缩进部分的制表符视为错误(默认未启用)。
blank-at-eof
将在文件末尾添加的空行视为错误(默认启用)。
trailing-space
a short-hand 涵盖
blank-at-eol
和blank-at-eof
。cr-at-eol
将行尾的 carriage-return 视为行终止符的一部分,也就是说,如果 carriage-return 之前的字符不是白色space(默认不启用)。
tabwidth=n
表示制表符占据多少个字符位置;这与 indent-with-non-tab 相关,当 Git 修复 tab-in-indent 错误时。默认制表符宽度为 8。允许的值为 1 到 63。
选项卡用作配置值时的输出示例: