Git忽略和Maven目标 [英] Git Ignores and Maven targets
问题描述
任何人都知道是否可以忽略由git管理的文件结构中的特定目录的所有实例。
Anyone know if it is possible to ignore all the instances of a particular directory in a file structure managed by git.
我想用一些子模块排除Maven项目中的所有'目标'文件夹。我知道我可以明确地排除顶层.gitignore中的每一个,但是我真的很希望能够指定一个像** / target / *那样的模式让它自动忽略子目录中的实例?
I'm looking to exclude all the 'target' folders in a maven project with a number of submodules. I know I can explicitly exclude each of them in a top level .gitignore, but I'd really like to be able to specify a pattern like **/target/* there to have it automatically ignore the instance in sub directories?
这可能吗?
推荐答案
.gitignore
文件。请参阅 gitignore手册页。模式 * / target / *
应该忽略任何名为target的目录及其下的任何目录。或者您可以尝试 * / target / **
来忽略目标下的所有内容。
It is possible to use patterns in a .gitignore
file. See the gitignore man page. The pattern */target/*
should ignore any directory named target and anything under it. Or you may try */target/**
to ignore everything under target.
这篇关于Git忽略和Maven目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!