我想在回购A中使用一些对回购B的修改。B不属于我。A是我的。
我做了:
git submodule add -- https://github.com/debois/elm-mdl.git external/elm-mdl即B是elm-mdl
我已经克隆了repo,因此在上面的命令中使用了--。
然后我跑:
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) 我可以将这些提交保存在我原来的repo A中吗?
或者有什么可供选择的?
发布于 2017-08-12 09:57:39
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,一个special entry in the index of the parent repo)。
https://stackoverflow.com/questions/45648811
复制相似问题