首页 > 解决方案 > 将远程 git 子树更改为我的分叉存储库

问题描述

在我的项目中,我有一个plugins文件夹,它是一个指向ntc-templatesrepo 的子树。

我为创建子树做了什么(来自此链接

git remote add ntc_templates https://github.com/networktocode/ntc-templates.git --no-tag
git fetch ntc_templates
git read-tree --prefix=plugins -u ntc_templates/master
git status
git commit -m "Add ntc-templates plugin"

后来我发现我必须在 ntc-templates 项目中添加一些功能。我创建了一个分支来将这些更改提交到子树,但它失败了,显然是因为我不是ntc-templates

git checkout -b blackport-ntc ntc_templates/master
git cherry-pick -x 0264b2671a3
git cherry-pick -x --strategy=subtree 25a01494ef6
git push ntc_templates HEAD:master

所以现在,我分叉了他们的仓库,偶然地,最后一次ntc-templates/master提交与我的分叉仓库相同(他们在我的克隆和我的 fork 之间没有新的提交)。

我怎样才能将我的子树从他们的仓库“迁移”到我的分叉树而不破坏我的仓库,因为 git 可能非常复杂......

非常感谢您的帮助

标签: gitgit-subtree

解决方案


推荐阅读