gitignore不适用于所有文件 [英] gitignore not working on all files

查看:75
本文介绍了gitignore不适用于所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试忽略项目中的某些文件.我在 .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不适用于所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆