I want to use
git config core.whitespace tab-in-indent,tabwidth=4
I want to have these settings for c++ files, so that I get warnings when ther
You can use gitattributes to tweak these settings. Here's a snippet of my .gitattributes file:
*.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
To adjust your whitespace settings, you could use something like:
*.ext whitespace=tab-in-indent,tabwidth=4
The *.ext
can point at paths, contain globs, etc. It's pretty flexible mechanism.