.gitignore is not ignoring one specific folder

I am developing a React Native project so there is a lot of crap that I don't actually need to push to the git repo. The node_modules is at the .gitignore file and it do not go to the repo as normal. The problem is that I do not need a folder called build too, that is inside of another folder called ios. So I created two .gitignore files, one I placed at the main directory with node_modules written, and the other one at the ios folder, with build/ written.

The problem is that only the node_modules folder is ignored as you can see here.


Your build folder is being ignored, as is your node_modules folder. The reason you're getting that specific message is that you instructed git to add it and it was warning you that it couldn't.

git add *

Means add each file in this folder to git. If you want to add all the untracked files and all changes, use:

git add .
    or
git add -a

Which means to add the current directory and all available children.

You can move both rules into a single .gitignore file at the root if you'd like, the rules will still work. You can also confirm that the rules are working by using:

git check-ignore -v [path]

Which will output the rule it is using to exclude the path if it is ignored.

链接地址: http://www.djcxy.com/p/45172.html

上一篇: 从git中永久删除一个目录

下一篇: .gitignore不会忽略一个特定的文件夹