I’m somewhat of a git newb so please bear with me here. I have a project that has a submodule that needs to be refreshed.
The project is using version 1 of the submodule and there are changes so I want to bump it to use the latest version.
How do I refresh the submodule and apply the changes so other users who clone or pulling from the project will use the latest updated version 1.5?
Here’s how the project looks:
ProjectA: remote repo configured to repoA
It relies on a submodule that points to repoB.
The .git/config file in the project root directory looks like:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@/github.com/foo/foo.git
There is also .gitmodules file in the project root directory:
[submodule "Vendor/some-external-library"]
path = Vendor/some-external-library
url = https://github.com/some-external-library/some-external-library.git
Within ‘some-external-library’ directory, there is no .gitmodules file, just the standard .git directory with the appropriate files. .git/config points to repoB.
Submodules are actually git repos that are checked out inside your main repo, and your main repo knows stuff about them, like which commit they have checked out.
So, what you probably want to do is go to the folder of the sumbodule and go
git pull origin master(or the commit you want to pull instead of master) and then do a commit that set reflects this change(the change on the submodule) on your main repoIn short:
You can also do
git submodule foreach git pullto update all the submodules references at on time, but that’s probably a bad idea regarding repo mantainability.More info at
git help submodule