【发布时间】:2020-08-17 15:13:15
【问题描述】:
我有一个多模块 maven 项目,在我的 .gitignore 文件中,我将忽略目标文件夹的模式设置为 /target/ 但是当我推送代码时,目标文件夹也被推送到远程仓库。
**MultiModule Maven Project structure:**
Parent module
Child1 module
Child2 module
现在,在我的远程仓库中,“目标”文件夹存在于 Child1 和 Child2 中,并且在我的本地仓库中,目标文件夹中有一些新代码出现在 git status 命令中,因为我已经运行了我的项目,并且它在这些目标中生成了新文件文件夹。我也尝试再次推送代码,以为它会忽略目标文件夹,但它没有,因为 git 仍在跟踪它们。
我必须从 Child1 和 Child2 中删除远程存储库中存在的目标文件夹,并且下次我进行代码推送时,应从 Child1 和 Child2 模块中忽略目标文件夹。我可以在这里做什么来满足这个要求?
【问题讨论】:
标签: git maven github maven-plugin gitignore