-
Changing The URL Of An Upstream Submodule Repository
Just a short one today.
Say you have a repository that contains a submodule. But, for whatever reason, you want to change the URL that the submodule points to. This could be because that repo moved, or changed it’s name. Or maybe you’ve forked that repository and you want to use your fork as a submodule.
All you need to do is to change the URL in the “.gitmodules” file (I wrote about doing this in my last post). Now, all you need to do is to run the command from the top level of the repository:
git submodule syncThis will update the local repository settings in “.git/config”.
Note
If you have more than one submodule, this will update all the submodules in “.git/config” the the URLs in “.gitmodules”. If you’ve set up your local repository with custom URLs (again, which I wrote about last time), this might not be what you want. You can choose to update submodule explicitly with:
git submodule sync -- namewhich will only sync the repository called “name”, which you can get from the “.gitmodule” file in the “Submodule” section. Be mindful of the spaces before and after
--.Posted on November 11, 2011 with 1 note ()
-
365git posted this
-