If this repo has not previously been used submodule then Git will create a directory in the directory called .gitmodules , which records the URL of the remote repo and the submodule in this project path.
After executing this command submodule and .gitmodules will automatically staged, this time can commit and push.
Individual repo update is too much trouble, it is necessary to separate directory under execution
git pullto pull the upstream code, but that would be more secure; all at once to update all of submodule can use this
I thought there will be like
git submodule rmsuch an instruction, the result is not even, you must manually remove the hard ground one by one, not knowing what not to implement this directive considerations, I hope that future versions can add to it.
Remove submodule has the following steps to do, first remove the submodule directory from the version control system:
Again to modify .gitmodules , remove the unwrought submodule, for example:
Not yet finished! But also modify the contents of .git / config , with. Gitmodules , the need to remove the submodule deleted, and finally commit.
git cloneGit clone does not automatically come together when submodule must be added
--recursiverecursive parameter, so you can catch all associated submodule in submodule down together:
If you have been caught to find submodule is empty, you can use the following instructions to catch,
initwill be registered in _.git / config` remote repo URL and local path:
Or merged into one line
git submodule update --init --recursivecan, if upstream someone to turn over .gitmodules , it seems that local end also using this method update.
git submodule init: According to .gitmodules name and URL, these information will be registered to . *Git */ config , but not .gitmodules not removed submodule, the use of this directive and no way to automatically delete. Git / config related content, you must manually delete ;
git submodule update: According to registered (that is, .git / config ) submodule to update, such as clone lost submodule, which is the last paragraph of the method, so the implementation of this instruction before the best plus
git submodule sync: If the submodule’s remote URL changes, you can correct the URL in .gitmodules , and then execute this command, the submodule’s remote URL will be corrected.