git submodules with others repos
I want to use in repo
A some changes of repo
B does not belong to me.
A is mine.
I did :
git submodule add -- https://github.com/debois/elm-mdl.git external/elm-mdl
I had already cloned the repo, hence
-- in above command.
I then run :
cd external/elm-mdl git checkout v9 git checkout v9-my .. make some changes and commit. cd ../..
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
Now, how can I keep these commits saved as i can not update or create a branch in remote repo
I can not update the remote :
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)
Can I save these commits in my original repo
Or what are the alternatives?
git config -f .gitmodules submodule.external/elm-mdl.branch v9-my
external/elm-mdlwill try to pull/update the
v9-mybranch: when you do modification in that submodule, you need to be in that branch (and to push your new commits to the remote repo of that submodule)
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
If you cannot push to the current repo, fork that repo (make it your own) an push there.
Then, when you have modified and committed and push in the submodule, you still need to go back to the parent repo, add, commit and push there too: it will save the new SHA1 of the submodule (its gitlink, a special entry in the index of the parent repo)