more functions on submodules and changing remote
understand and implement following concepts.... (seen on https://longair.net/blog/2010/06/02/git-submodules-explained/ )
Change the remote for a submodule
If you frequently work in a submodule you might want to change the default remote “origin” to refer to a URL that you can push to, just so you can use one remote for everything. You can do this by deleting orgin and adding it back with a new URL, with e.g.:
$ cd commonlib $ git remote rm origin $ git remote add origin ssh://mark@git.mysociety.org/data/git/public/commonlib.git $ git remote -v origin ssh://mark@git.mysociety.org/data/git/public/commonlib.git
However, you’ll find that two helpful config options will have been deleted when removing and adding back origin, so you’ll want to add these back.
$ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master
These config options set up the helpful defaults for git pull when you’re on master.
If you’re in the habit of deleting whole submodules, and then recreating them with git submodule update then you should also make sure that you change the URL in the super-project’s config settings, e.g.:
$ git config --list|egrep submodule submodule.commonlib.url=git://git.mysociety.org/commonlib $ git config submodule.commonlib.url ssh://mark@git.mysociety.org/data/git/public/commonlib.git $ git config --list|egrep submodule submodule.commonlib.url=ssh://mark@git.mysociety.org/data/git/public/commonlib.git