I created a project submodule
and put it up on Github.
I created another project, supermodule
, and then did this:
cd supermodule git init mkdir lib git clone git://github.com/tandu/submodule lib/submodule git submodule add ./lib/submodule lib/submodule
This worked fine, but on the website, it can't find the link to the submodule when viewing the files (in fact it just says "Loading Commit data" forever). The submodule folder itself has the correct origin
.
Apparently, what I should have done was
... mkdir lib git submodule add git://github.com/tandu/submodule lib
...but it's too late for that now. How can I have the submodule in this project correctly point to origin
?
Git Submodules Moving a submodule If needed, create the parent directory of the new location of the submodule ( mkdir -p new/path/to ). Move all content from the old to the new directory ( mv -vi old/path/to/module new/path/to/submodule ). Make sure Git tracks this directory ( git add new/path/to ).
The submodule is just a separate repository. If you want to make changes to it, you should make the changes in its repository and push them like in a regular Git repository (just execute the git commands in the submodule's directory).
This apparently is very much dependent on the version of git you are using.
url
entry in the [submodule "<dirname>"]
section of the .gitmodules
file.url
entry in the [submodule "<dirname>"]
section of the .git/config
file.url
in the configuration of the submodule itself. The location of the config
file is version dependent. Older versions had it in <dirname>/.git/config
, newer ones in .git/modules/<dirname>/config
. However, you can always use below command:cd <dirname> git config remote.origin.url <new_url>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With