Git 忽略子项目中的公共目录
Git Ignore common directories in subprojects
一个大项目下有多个git个项目(使用springboot)
ContainerProject
-.gitignore
Subproj1/
-.gitignore
-target/
Subproj2
-.gitignore
-target/
....
我需要忽略伞项目 .gitignore
中所有项目中的目标文件夹。
我试过了
**/target/
**/target
**/target/*
但是 none 似乎对我有用。 git status
容器项目仍然列出子项目中这些目标文件夹的更改。
只需在 .gitignore
:
中执行此操作
target
应该可以!
示例:
我在以下示例树的 .gitignore
中有上述条目 (target
):
Test
- .gitignore
- abc
- target/a.txt
- xyz
- target/a.txt
- test
- target/a.txt
使用 git status
或从 Git GUI,target
目录条目不可见。
一个大项目下有多个git个项目(使用springboot)
ContainerProject
-.gitignore
Subproj1/
-.gitignore
-target/
Subproj2
-.gitignore
-target/
....
我需要忽略伞项目 .gitignore
中所有项目中的目标文件夹。
我试过了
**/target/
**/target
**/target/*
但是 none 似乎对我有用。 git status
容器项目仍然列出子项目中这些目标文件夹的更改。
只需在 .gitignore
:
target
应该可以!
示例:
我在以下示例树的 .gitignore
中有上述条目 (target
):
Test
- .gitignore
- abc
- target/a.txt
- xyz
- target/a.txt
- test
- target/a.txt
使用 git status
或从 Git GUI,target
目录条目不可见。