Tried looking for answers on this site and others: StackOverflow - Easy way pull latest of all submodules
They all seem to want to talk about if you are controlling them, not if someone else added one, and I just want to pull the additional one into my project without having to stash or backup my changes if I need to delete the folder.
Should I delete the .gitmodules
file, and/or the submodule directories that I have already pulled down with git clone --recursive
? (StackOverflow - How to git clone
including submodules?)
These commands do not seem to help either:
git submodule update --init --recursive
seems like it did nothing.git submodule update --recursive
nothing.git fetch --recurse-submodules
output Fetching submodule ...
several times.git pull --recurse-submodules
output the same thing, and then said Already up-to-date.
after the fetch trial. Strange since in either case my submodules were already downloaded.git clone --recursive ...
Not tried yet. I feel like would overwrite any changes I have made, in the Stash or otherwise.git submodule update --recursive --remote
checked out a new commit SHA for one of the submodules.git submodule update --recursive
checked out a new commit SHA for one of the submodules. Could be the older, original commit level.git submodule status
gives the appropriate SHA, version, and name information for each, while still lacking the one that I want.git submodule foreach git pull origin master
git submodule update
does nothing.I have been double-checking the library directory manually each time to make sure whether the additional submodule appeared or not.
I want to avoid performing certain actions, unless they are not destructive to my current repository state containing code changes, and solves my problem, in case it is a command I have mentioned but did not run, or anyone else has another to try.
I could try some of these with more effort, but I think I want to stop messing with them for now, and since I have not found the answer to this issue after doing some online searching, maybe the hopeful and eventual answer would help others anyway.
Am I suffering from the con mentioned here at all? Software Engineering - Git submodule vs Git clone
More links:
In order to add a Git submodule, use the “git submodule add” command and specify the URL of the Git remote repository to be included as a submodule. When adding a Git submodule, your submodule will be staged. As a consequence, you will need to commit your submodule by using the “git commit” command.
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 .
The list of steps required to clone a Git repository with submodules is: Issue a git clone command on the parent repository. Issue a git submodule init command. Issue a git submodule update command.
git submodule update --init local/path/to/submodule/folder
You have to do two things:
git pull
in your main repository which holds the submodules. This will add the new submodule as an empty directory.git submodule update --recursive --remote
in the main repository. This will pull the latest changes for all submodules, including the new one.This works at least in Git 2.13. Also note that if the repositories and submodules are on GitHub, you have to make sure you have access rights to them (if they are private).
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