问题描述
我正在尝试忽略项目中的某些文件.我在 .gitignore
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
我看到以下文件被忽略
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?
我从这两个文件中只提取了2个文件,分别是被忽略的文件和未被忽略的文件,但是我希望忽略的文件更多,而不会被忽略.
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.
推荐答案
这很可能是因为您在之前提交了它,然后在.gitignore
中添加了*.tlog
.
That's most probably because you committed it before adding *.tlog
in your .gitignore
.
使用git rm
将其从git中删除并提交更改:
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.
这篇关于gitignore不适用于所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!