Reputation: 5754
I have a project where I added a git submodule to a fork of a repo that is out of date. Rather than pointing to that fork, I decided to change the submodule reference to point to the original repo instead.
I edited the .gitmodules
file to reflect the new reference and ran git submodule init
and git submodule update --recursive
however there is no effect, am I missing a step here?
Upvotes: 1
Views: 562
Reputation: 1324937
neevek mentions .git/config
, and the documentation of git config
confirms:
submodule..path submodule..url submodule..update
The path within this project, URL, and the updating strategy for a submodule.
These variables are initially populated bygit submodule init
; edit them to override the URL and other values found in the.gitmodules
file.
So:
.gitmodules
alone isn't enough (the url in the .git/config
will have precedence).git submodule init
, as the documentation mentions, does not alter existing information in .git/config
(and that explains why your commands didn't have any visible effect)..git/config
for your local setup and proceed to git submodule update
.I personally find this url duplication a bit confusing...
Upvotes: 2