无法理解gitignore如何忽略文件夹 [英] Can't understand how gitignore ignores the folders
问题描述
我想为我的Magento项目创建存储库。根目录中有很多文件夹和文件,我只改变一个文件夹的时间:app / code / local /
我想忽略的其他一切。但..不能。我的.gitignore文件:
*
!app / code / local /
!app / code /本地/ *
然后,当我尝试将文件夹添加到回购站时,出现错误:
git add app / code / local / Mds /
您的.gitignore文件之一会忽略以下路径:
app
如果您真的想添加它们,请使用-f。
致命:没有添加文件
任何人都可以帮忙吗?
在下面尝试忽略您的需要:
/ *
!/ app /
/ app / *
!/ app / code /
/ app / code / *
!/ app / code /本地/
以下讨论很有帮助:http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-fun-td1675067 .html ,特别是来自Linus的以下内容:
这就是设计。您已选择忽略这些目录;他们自己匹配*
。因此,'git add。'不会下降到他们寻找文件的地方。
因此,基本上,您必须进入每个级别,取消管理该文件夹,并忽略该文件夹内的内容。
I want to create repository for my Magento project. There are lots of folders and files in root directory and I change time to time only one folder: app/code/local/
Everything else I want to ignore. But.. can't. My .gitignore file:
*
!app/code/local/
!app/code/local/*
Then when I try to add folder to repo I get an error:
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
Can anyone please help with this?
Try below to ignore like you need:
/*
!/app/
/app/*
!/app/code/
/app/code/*
!/app/code/local/
The following discussion was helpful: http://git.661346.n2.nabble.com/negated-list-in-gitignore-no-fun-td1675067.html , especially the following from 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.
So basically, for each level you have to go in, unignore that folder, and ignore contents within that folder.
这篇关于无法理解gitignore如何忽略文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!