gitignore 目录模式忽略具有相同后缀的文件夹,但我想包含它
我有以下目录结构:
src/ out/ cout/ ...
并且我想忽略 out/
但不是 cout/
。
我尝试过添加 ^out/
,但这似乎不起作用。 我也尝试过 out/
但也忽略了 cout/
。
有什么建议么?
I have the following directory structure:
src/ out/ cout/ ...
and I want to ignore out/
but not cout/
.
I've tried putting ^out/
, but that doesn't seem to work. I've also tried out/
but that also ignores cout/
.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感叹号(!)应该在匹配之前,不应被忽略。
.gitignore
文件应如下所示:Exclamation mark(!) should precede a match which should not be ignored.
The
.gitignore
file should look like:对不起各位,我的错误!
cout
目录为空,因此未显示在git status
下。只需添加
out/
即可正常工作,并且不会忽略cout/
。多谢!
Sorry guys, my mistake! The
cout
directory was empty and, therefore, not showing up undergit status
.Just adding
out/
works fine and doesn't ignorecout/
.Thanks a lot!
你使用的是哪个版本的 git?
使用 msysgit 1.6.3-preview20090507-2,这个简单的
方法对我来说很有效。 cout/ 仍添加到存储库中。
Which version of git are you using?
With msysgit 1.6.3-preview20090507-2, the simple
works for me. cout/ is still added to the repository.