Git 忽略和 Maven 目标 [英] Git Ignores and Maven targets

查看:11
本文介绍了Git 忽略和 Maven 目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道是否可以忽略由 git 管理的文件结构中特定目录的所有实例.

我希望排除具有多个子模块的 maven 项目中的所有目标"文件夹.我知道我可以在顶级 .gitignore 中明确排除它们中的每一个,但我真的希望能够在那里指定像 **/target/* 这样的模式让它自动忽略子目录中的实例?

这可能吗?

解决方案

可以在 .gitignore 文件中使用模式.请参阅 gitignore 手册页.模式 */target/* 应该忽略任何名为 target 的目录及其下的任何内容.或者您可以尝试 */target/** 忽略目标下的所有内容.

Anyone know if it is possible to ignore all the instances of a particular directory in a file structure managed by git.

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?

Is this possible?

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆