Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pull --rebase converting spaces to tabs

This problem is driving me mad. Using Git with Github.

I'm working on one particular file using spaces instead of tabs. I always ensure that I change all tab indents to spaces. Diffs confirm that I've changed tabs to spaces. I commit and push the code (with other changes) and all is good.

Until, I git pull --rebase. Now, my file -- in parts -- has tabs replacing spaces! Note, this is on parts of the file that only I have ever edited and I always use spaces, not tabs.

It doesn't happen when I do a normal git pull, only on rebase.

Additionally, changes on other branches that are merged into the main integration branch are also OK. It's just happens on rebase of the integration branch.

like image 690
Tim W. Avatar asked Feb 08 '13 19:02

Tim W.


1 Answers

git apply --whitespace=fix 

appears to make that happen during rebase.

Maybe set

[apply]
    whitespace = warn

in your gitconfig and see if it resolves your issue.

See also the "core.whitespace" setting for more.

like image 67
heurist Avatar answered Oct 03 '22 02:10

heurist