我想用
git config core.whitespace tab-in-indent,tabwidth=4
Run Code Online (Sandbox Code Playgroud)
我想对c ++文件进行这些设置,以便在使用git diff时出现错误缩进时会收到警告.但是,我还有需要制表符的Makefile.有没有办法为不同的文件配置不同的空格设置?
Joh*_*ter 10
您可以使用gitattributes调整这些设置.这是我的.gitattributes文件的片段:
*.c text diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent
*.cpp text diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent
*.h text diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent
*.hpp text diff=cpp whitespace=trailing-space,space-before-tab,tab-in-indent
*.py text diff=python whitespace=trailing-space,space-before-tab,tab-in-indent
*.tex text diff=tex whitespace=trailing-space,space-before-tab,tab-in-indent
*.java text diff=java whitespace=trailing-space,space-before-tab,tab-in-indent
*.pl text diff=perl whitespace=trailing-space,space-before-tab,tab-in-indent
*.php text diff=php whitespace=trailing-space,space-before-tab,tab-in-indent
*.rb text diff=ruby whitespace=trailing-space,space-before-tab,tab-in-indent
*.vcproj eol=crlf
*.dsp eol=crlf
*.dsw eol=crlf
*.sh eol=lf
*.jpg binary
*.png binary
*.gif binary
*.tiff binary
Run Code Online (Sandbox Code Playgroud)
要调整空白设置,您可以使用以下内容:
*.ext whitespace=tab-in-indent,tabwidth=4
Run Code Online (Sandbox Code Playgroud)
将*.ext在路径可以点,包含水珠,等,这是非常灵活的机制.
| 归档时间: |
|
| 查看次数: |
1817 次 |
| 最近记录: |