本文翻译自:How do I ignore files in a directory in Git?
What is the proper syntax for the .gitignore
file to ignore files in a directory? .gitignore
文件忽略目录中文件的正确语法是什么?
Would it be 可不可能是
config/databases.yml
cache/*
log/*
data/sql/*
lib/filter/base/*
lib/form/base/*
lib/model/map/*
lib/model/om/*
or 要么
/config/databases.yml
/cache/*
/log/*
/data/sql/*
/lib/filter/base/*
/lib/form/base/*
/lib/model/map/*
/lib/model/om/*
? ?
#1楼
参考:https://stackoom.com/question/ZmPt/如何忽略Git中目录中的文件
#2楼
If you want to put a .gitignore file at the top level and make it work for any folder below it use /**/
. 如果要将.gitignore文件放在顶层并使其适用于下面的任何文件夹,请使用/**/
。
Eg to ignore all *.map
files in a /src/main/
folder and sub-folders use: 例如,要忽略/src/main/
文件夹和子文件夹中的所有*.map
文件,请使用:
/src/main/**/*.map
#3楼
I'm maintaining a GUI and CLI based service that allows you to generate .gitignore
templates very easily at https://www.gitignore.io . 我正在维护基于GUI和CLI的服务,允许您在https://www.gitignore.io上轻松生成.gitignore</