Dominic Reich
e8393d95a3
- post aliases instead of redirects - some dates were wrong, fixed and create multiple aliases to not brake the old date - fix some typography like newlines on end of file
944 B
944 B
+++ title = "Change git submodule URL" aliases = '/posts/2022-11-26-change-git-submodule-url' summary = """Another thing I forget constantly when using git: Changing the remote URL of a submodule""" date = "2022-12-01T20:08:17+01:00" lastmod = '2023-11-18T22:01:29+0000' categories = ["computerstuff"] tags = ["git"]
+++
If the location (URL) of the submodule has changed, then you can simply:
-
Modify the .gitmodules file in the repo root to use the new URL.
-
Delete the submodule folder in the repo
$ rm -rf .git/modules/<submodule>
-
Delete the submodule folder in the working directory
$ rm -rf <submodule>
-
Run
$ git submodule sync
-
And run
$ git submodule update
More complete info can be found elsewhere:
https://stackoverflow.com/questions/913701/changing-remote-repository-for-a-git-submodule