First off, I'm new to git. For example, I could barely indicate the cache from the index if it hit me in the intermediate area. Or something like that. From this point of view, my problem is this:
Suppose I want to work on a project whose coding style sets spaces for indentation, but I like the tabs. It seems that I can use clean and spotty features, but there is a trick. The coding style is not executed sequentially, and there are some files that mix tabs and spaces on the same line. Thus, a naive approach will lead me to make a one-line change, but accidentally create a mass commit that will bring the project into full compliance with its own standards. That would be great, except that the differences would be less useful, so I get new enemies.
So, the question is, is there a way to make this magic work in such a way that, if I do not touch the file, it remains out of the picture? (I am ready to take full responsibility for the spaces of files that I touch, even if I change only one character.)
EDIT: Well, I just accepted the answer that I accepted yesterday. I am pretty sure this is very rude. My excuse is that I only checked it today. Since, apparently, two people already misunderstood me, let me clearly understand what I actually did, so maybe someone can tell me if I was confused and / or confused.
$ ls -a
. .. t.txt
$ hd t.txt
00000000 09 41 0a |.A.|
00000003
$ git init
Initialized empty Git repository in /home/marvy/test/.git/
$ git config
$ git config
$ git add t.txt
$ git commit
[master (root-commit) 959bf99] testing cleverness of git status
1 file changed, 1 insertion(+)
create mode 100644 t.txt
$ echo '*.txt filter=tabspace' > .git/info/attributes
$ cat .git/info/attributes
*.txt filter=tabspace
$ git config
$ git config
$ rm t.txt
$ git checkout t.txt
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: t.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git help
As we see here, git reports that t.txt has been changed, although I just checked it. If you run git diff, it will require me to convert tabs to spaces. Am I doing something wrong?