[英]How to add a folder to the .gitignore
也许我缺乏谷歌搜索技能,但这似乎是一个应该给我带来数千次点击的问题,然而,我找不到直接的答案。
就这么简单:
我不断推送到 github 以与远程开发人员共享。 我们都安装了npm
和bower
。 无需一直将这些庞大的文件夹推送到 github。 我的node_modules
被忽略。 但我似乎无法让gitignore
忽略我的bower_components
文件夹
我对 cmd 不太了解,我几乎没有触及表面,所以如果你打算建议,请不要假设我知道你在说什么。 否则,如果它像使用 IDE 将它添加到文件本身一样简单,那么,我做到了,没有雪茄。 这是我的 .gtignore 文件供您查看
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing- task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
bower_components
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
我错过了什么吗? 如何使 bower_components 被忽略?
谢谢
如果你想忽略文件夹,你需要一个斜杠:
bower_components/
然后使用git check-ignore -v
规则是否适用(如果您想查看导致文件被忽略的确切.gitignore
文件和行, -v
很重要)
git check-ignore -v -- bower_components/afile
如果这不适用,则从该存储库的历史记录中删除该文件夹的内容:
git rm --cached -r -- bower_components/
git add .
git commit -m "Remove bower_components folder"
然后.gitignore
规则将立即生效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.