Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git子模块与其他repos_Git - Fatal编程技术网

git子模块与其他repos

git子模块与其他repos,git,Git,我想在repoA中使用repoB的一些更改B不属于我一个是我的 我做到了: git submodule add -- https://github.com/debois/elm-mdl.git external/elm-mdl i、 e.Biselm mdl 我已经克隆了repo,因此在上面的命令中-- 然后我运行: cd external/elm-mdl git checkout v9 git checkout v9-my .. make some changes and commit. c

我想在repo
A
中使用repo
B
的一些更改<代码>B不属于我<代码>一个是我的

我做到了:

git submodule add -- https://github.com/debois/elm-mdl.git external/elm-mdl
i、 e.
B
is
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
现在,我如何保存这些提交,因为我无法在远程repo
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
分支:当您在该子模块中进行修改时,您需要在该分支中(并将新提交推送到该子模块的远程repo)

如果你不能推动当前的回购协议,那就推动该回购协议(让它成为你自己的)


然后,当您修改并提交并推入子模块后,您仍然需要返回父repo,在那里添加、提交并推入:它将保存子模块的新SHA1(其,a)

uh。。因此,没有叉子我就无法工作(…我希望had能只保存原始回购中的承诺..感谢您的解释。@AshishNegi确切地说:forking允许您保存这些新的承诺,并让您的父回购引用它们。是的..我在等待其他人提出一些有趣的建议..谢谢
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