与其他仓库的git子模块

阿什什尼吉

我想在回购中使用A一些回购更改BB不属于我。A是我的。

我做了:

git submodule add -- https://github.com/debois/elm-mdl.git external/elm-mdl

Belm-mdl

我已经克隆了仓库,因此--在上面的命令中。

然后我运行:

cd external/elm-mdl
git checkout v9
git checkout v9-my
.. make some changes and commit.
cd ../..

回到A

git config -f .gitmodules submodule.external/elm-mdl.branch v9-my

└─ $ ▶ cat .gitmodules 
[submodule "external/elm-mdl"]
    path = external/elm-mdl
    url = https://github.com/debois/elm-mdl.git
    branch = v9-my

现在,我怎样才能把这些提交保存为我不能更新或远程回购创建一个分支B,即elm-mdl

我无法更新遥控器:

ashish @ 7567 ~/work/be_autonomous (master) 
└─ $ ▶ git submodule update  --remote --merge
fatal: Needed a single revision
Unable to find current origin/v9-my revision in submodule path 'external/elm-mdl'
ashish @ 7567 ~/work/be_autonomous (master) 

我可以将这些提交保存在我的原始存储库中A吗?
还是有什么选择?

git config -f .gitmodules submodule.external/elm-mdl.branch v9-my

这意味着external/elm-mdl将尝试拉/更新v9-my分支:在该子模块中进行修改时,您需要位于该分支中(并将新提交提交到该子模块的远程仓库中)

cd external/elm-mdl
git checkout -b v9-my
# work
git add .
git commit -m "new commit in v9-my branch"
git push -u origin v9-my

如果您无法推送到当前存储库,请在该存储库中分叉该存储库(使其成为您自己的)。

然后,在修改并提交并推入子模块后,您仍然需要返回到父存储库,也进行添加,提交和推入:它将保存子模块的新SHA1(其gitlink在父仓库的索引

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章