我有一个非常具体的工作流程,原因是我习惯git subtree将一个项目包含在另一个项目中:
本地 git 存储库
styling,由pull远程存储库 (styling-exchange) 更新;另一个本地存储库
styling-bare,用于同步styling和code另一个本地 git 存储库
code,它通过名为( )的远程分支将code/styling子目录添加为子树styling../styling-bareproduction可以更新code的远程存储库git push production master
它应该如下所示:
code
|--/.git
|--.gitignore
|--/styling
| |--file1
| |--file2.v1
|--file3
styling-bare
styling
|--/.git
|--.gitignore
|--file1
|--file2.v2
工作流有两个用例:
cdintostyling, pull fromstyling-exchange, 然后cdintocode, 更新子树, 对andstyling做一些改变file1and , push tofile2file3productioncdinto ,对andcode进行一些更改,将更改推送到(子树推送),into , pull from ,将更改推送到file1file2file3styling-barecdstylingstyling-barestyling-exchange
我想file2在本地存储库styling/styling-bare与code/production存储库中有两个完全不同且独立的版本。我需要从styling子树中获取所有更新code/styling,但我需要在file2内部进行跟踪code,而不需要从styling.
即,我想更新存储库styling中的子树code,但保留我自己的版本file2(同时在and和 file3 之间file1同步和在and之间同步),以便我可以将我自己的版本(v1)推送到以后。stylingcodecodeproductionfile2production
在 git 中是否有任何优雅的方法可以做到这一点,而无需符号链接或一些复杂的钩子?
请注意,我已经尝试过: