我目前正在使用一个最近为了封闭源而被分解的存储库 - 模块已从“主要”存储库移到他们自己的存储库中。
panel/
file.a
file.b
module1/ [untracked by panel repository, instead tracked in own repository now]
templates/
base.html
...
views.py
但是,在此分解之前仍有工作已提交,当时module1
存储库仍是panel
. 我的问题是处理分手前后的提交 - 我目前正在尝试cherry-pick
提交对两者中的文件进行更改,panel
以及module1
在两个存储库都属于panel
. (目录结构没有改变,只有git
's view of the repositories)
当我在主存储库的目录中挑选时:
nasonfish@nasonfish ~/P/P/p/panel2> git cherry-pick 8b7316d1ebff49e95a7971f88e669f50d9cbbf86
error: refusing to lose untracked file at 'panel/module1/views.py'
error: refusing to lose untracked file at 'panel/module1/templates/module1/view-hdr.html'
error: refusing to lose untracked file at 'panel/module1/templates/module1/view-base.html'
error: refusing to lose untracked file at 'panel/module1/templates/module1/base.html'
error: could not apply 8b7316d... mybranch: This is my commit
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
我可以看到我不希望将存储库中的文件删除或添加到主存储库,因为这只会撤消分离并合并存储库 - 但我正在尝试将提交的cherry-pick
应用程序提交给两个文件中的文件基本和子存储库,而不合并两者。那么,有没有一种方法可以强制 git 以某种方式让单独的嵌套存储库中的文件成为主存储库的一部分,从而允许从存储库分离之前挑选提交?