When I use
git config --global <some option> <some value>
This is what worked for me (note that as @rasjani has pointed out in a comment, there is no option to prevent git from inserting a tab in the first place when using
filter to convert tabs to spaces automatically as soon as you do a
git add for a file. This filter is created by
git config --global filter.spacify.clean 'expand --tabs=4 --initial'
expand command says that
convert each tab character at the beginning of line to 4 space characters
Therefore the definition of the filter includes both what it does and for when it does it (i.e. for which git operation).
(On OSX, you would need to use
gexpand after installing coreutils by doing a
brew install coreutils)
Of course, you would need to decide the scope (
--global or the default
--local) of the above configuration.
For instance, for your repository, create a
.git/info/attributes with the following content:
This says that
apply the spacify filter to any files that match the pattern .* before these files are committed to the repository.
Note that the above will only affect new files being added to the repository. If you want this to be done for all existing files, then you could either run
expand manually OR, could get git to do it for us like so:
git config --global filter.spacify.smudge 'expand --tabs=4 --initial' git checkout HEAD -- **
spacify filter for
smudge will cause the filter to be applied to files being checked out. After the checkout, you should see a bunch of changes to the dot files which had leading tabs converted to spaces. Re-commit these and from henceforth, the
clean duo shall keep your dotfiles tab-free!
Here is a pull request for your repo : https://github.com/raxod502/radian/pull/156