I'm trying to use git submodule update
and it's not returning anything, nor does any of the git submodule
commands, and I have checked the .gitmodules
file and it is correct?
I have no idea if git can be debugged or what, and it's really annoying.
There's no errors or anything, even when using 2>&1
on the end which is really worrying.
You can fix it by: either committing or undoing the changes/evolutions within each of your submodules, before going back to the parent repo (where the diff shouldn't report "dirty" files anymore). To undo all changes to your submodule just cd into the root directory of your submodule and do git checkout .
If you already cloned the project and forgot --recurse-submodules , you can combine the git submodule init and git submodule update steps by running git submodule update --init . To also initialize, fetch and checkout any nested submodules, you can use the foolproof git submodule update --init --recursive .
By default your submodule repository is in a state called 'detached HEAD'. This means that the checked-out commit -- which is the one that the super-project (core) needs -- is not associated with a local branch name.
A git submodule is a record within a host git repository that points to a specific commit in another external repository. Submodules are very static and only track specific commits. Submodules do not track git refs or branches and are not automatically updated when the host repository is updated.
It could be a late answer but in case someone needs it:
Just delete you blank submodule directory and run again
git submodule add <https/ssh git link to your submodule
>
Remove any submodule entries from your .git/config
. git rm --cached path/to/submodule
to remove it from the tree. Make sure your working directory is clean. Now you can init the submodules:
git submodule init
All this does is populate your config with the urls that are in the .gitmodules
file. Now you can populate the submodules:
git submodule update
if your submodules have nested submodules, add the recursive option:
git submodule update --recursive
Init and update are separate for a good reason. You may want to have an alternate repository to store changes to you submodule.
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