我想为我的Magento项目创建存储库。根目录下有很多文件夹和文件,我经常只更改一个文件夹: app/code/local/
其他我想忽略的东西。但是..。不能。我的.gitignore文件:
*
!app/code/local/
!app/code/local/*然后,当我尝试将文件夹添加到存储库时,我得到一个错误:
git add app/code/local/Mds/
The following paths are ignored by one of your .gitignore files:
app
Use -f if you really want to add them.
fatal: no files added有人能帮个忙吗?
发布于 2011-04-21 15:20:29
试着在下面忽略你所需要的:
/*
!/app/
/app/*
!/app/code/
/app/code/*
!/app/code/local/下面的讨论很有帮助:http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-fun-td1675067.html,尤其是来自Linus的以下内容:
That's by design. You've chosen to ignore those directories; they match "*" themselves. Thus, 'git add .' doesn't descend into them looking for files.
因此,基本上,对于每个级别,您必须进入,取消忽略该文件夹,并忽略该文件夹中的内容。
发布于 2011-04-21 08:40:45
这个.gitignore在回购的根目录中吗?
试试这个:
/*
!/app/code/local发布于 2014-08-07 22:08:40
根据the documentation的说法
“如果文件的父目录被排除,则无法重新包含该文件。”
例如,如果您已经在使用存储库,并告诉Git忽略父目录,进行了一些提交,然后返回并尝试允许排除目录的某个子目录,即使您的 .gitignore 文件是正确的,它也不会包括该子目录。要解决此问题,您需要强制添加它(使用-f标志):
git add -f {file}完成此操作后,将跟踪后续更改。
https://stackoverflow.com/questions/5738204
复制相似问题