无法忽略被忽略目录中的某个文件

时间:2014-05-20 00:39:14

标签: git gitignore

我有.gitignore喜欢这个

**/my-site/components/*

所以我完全忽略了/components文件夹。好吧,我刚刚攻击了这个文件夹里的文件,我可以取消它吗?

!**/my-site/components/com_content/models/articles.php
嗯......那不行。我们来试试吧。

!**/my-site/components/com_content/models/*

这也不起作用。好奇。也许这个会起作用吗?

!**/my-site/components/com_content/*

呜! 75个未跟踪的文件。惊人。我是白痴还是这个?我见过的最奇怪的行为。

现在......这里发生了什么?我只想将一个文件取消忽略到忽略的文件夹中。

更新

是的,我知道,我可以做这样的事情

!**/my-site/components/com_content/
**/my-site/components/com_content/*.*
**/my-site/components/com_content/controllers/*
**/my-site/components/com_content/helpers/*
**/my-site/components/com_content/models/*
!**/my-site/components/com_content/models/articles.php
**/my-site/components/com_content/views/*

但我正在寻找更优雅的解决方案。

1 个答案:

答案 0 :(得分:2)

Not ignore a file in a sub directory?

也许是这样的?已经有一段时间了,因为我使用了git,但我认为你应该可以从链接中获取它。

!**/my-site/components/
!**/my-site/components/com_content/
!**/my-site/components/com_content/models/
**/my-site/components/*
!articles.php

修改的 怎么样:

!**/my-site/components/
**/my-site/components/*
!com_content/models/articles.php
相关问题