使用 .gitignore 忽略具有不同扩展名的文件
Ignoring files having different extensions with .gitignore
我想忽略某个文件夹 (data/
) 中扩展名为 *.mtx
或 *.otc
的所有文件以及所有子文件夹中扩展名为 *.pyc
的所有文件。这个 .gitignore
应该有用吗?
/data/*.mtx
/data/*.otc
*.pyc
有没有办法让它更紧凑?显然这不起作用:
/data/(*.mtx|*.otc)
*.pyc
I'd rather not use local gitignore unless strictly necessary, because it seems to me tidier to have all "ignore" instructions in one place, but I'm open to suggestions here
您只能在存储库的根文件夹中保留一个 .gitginore。
**/data/*.mtx
**/data/*.otc
*.pyc
这将忽略数据文件夹中的 mtx
或 otc
文件,即使数据不是顶级文件夹(因为您没有使用锚点“/”)。
检查这是否适用于:
git check-ignore -v path/to/a/file
我想忽略某个文件夹 (data/
) 中扩展名为 *.mtx
或 *.otc
的所有文件以及所有子文件夹中扩展名为 *.pyc
的所有文件。这个 .gitignore
应该有用吗?
/data/*.mtx
/data/*.otc
*.pyc
有没有办法让它更紧凑?显然这不起作用:
/data/(*.mtx|*.otc)
*.pyc
I'd rather not use local gitignore unless strictly necessary, because it seems to me tidier to have all "ignore" instructions in one place, but I'm open to suggestions here
您只能在存储库的根文件夹中保留一个 .gitginore。
**/data/*.mtx
**/data/*.otc
*.pyc
这将忽略数据文件夹中的 mtx
或 otc
文件,即使数据不是顶级文件夹(因为您没有使用锚点“/”)。
检查这是否适用于:
git check-ignore -v path/to/a/file