Git submodule url changed

Nobody speaks about how and what files one has to commit

No need to change a file, sync/commit: this is now done for you in one new command.

With Git 2.25 (Q1 2020), “git submodule” learned a subcommand “set-url“.

See commit 26b0610 (29 Oct 2019) by Denton Liu (Denton-L).
(Merged by Junio C Hamano — gitster in commit 99c4ff1, 10 Dec 2019)

submodule: teach set-url subcommand

Signed-off-by: Denton Liu

Currently, in the event that a submodule’s upstream URL changes, users have to manually alter the URL in the .gitmodules file then run git submodule sync.
Let’s make that process easier.

Teach submodule the set-url subcommand which will automatically change the submodule.$name.url property in the .gitmodules file and then run git submodule sync to complete the process.

The git submodule documentation now includes:

set-url [--] <path> <newurl>:

Sets the URL of the specified submodule to <newurl>.
Then, it will automatically synchronize the submodule’s new remote URL configuration.

Leave a Comment