I am trying to ignore some files from my project. I have the following extensions in .gitignore
*.opensdf
*.sdf
*.tlog
*.cer
*.cat
*.inf
*.tmh
*.inf
I see the following file is ignored
D:\Projects\driver1\driver1\inter\Win32\Win7Debug\link.command.1.tlog
but the following file is seen as Modified, thus this one is not ignored.
D:\Projects\driver1\ioctlapp\inter\Debug\link.write.1.tlog
Why the second file isn't ignored and how can i fix the problem?
I took only 2 files from both, from ignored and not ignored files, but there are more files which I expect to ignore and they aren't.
That's most probably because you committed it before adding *.tlog
in your .gitignore
.
Use git rm
to remove it from git and the commit the changes:
git rm D:\Projects\driver1\ioctlapp\inter\Debug\link.write.1.tlog
git commit -m 'Removed link.write.1.tlog'
Next time when you will edit it, it will be ignored.
First check if file is tracked git ls-files --error-unmatch file_name
If you don't see error, then it's tracked. Remove it from index but not from disk with git rm --cached
. After that commit that change. Let me know if it helped you.
来源:https://stackoverflow.com/questions/33101106/gitignore-not-working-on-all-files