【发布时间】:2020-02-10 02:45:46
【问题描述】:
我有一个 repo,其中包含一个包含一些构建和配置文件的子树。
main
├── .gitignore
└── build (subtree)
├── .gitignore
└── config.user.json
└── config.site.json
└── index.js
我想忽略来自main 存储库和build 子树的config.user.json,但是保留 config.site.json 在主存储库中,但是在build 子树中忽略它。
main/.gitignore
!build/config.site.json # (this is supposed to reverse the ignore)
build/config.user.json
构建/.gitignore
build/config.site.json
build/config.user.json
这可能吗,或者我应该将我的配置文件放在与build 不同的文件夹中。我感觉子树中的 .gitignore 会覆盖主仓库中的 .gitignore 而不是相反。
参考号:Git Subtree Specific Ignoring
干杯
【问题讨论】:
-
我认为这不可能。一旦忽略子树中的某些内容,就无法在顶层取消忽略它。在链接的 REF 中,情况正好相反——取消忽略顶层忽略的子树中的某些内容;这是可能的,但反过来不行。
-
感谢您的回答。我将不得不解决其他问题。
标签: git gitignore git-subtree