The Project is having one sub module and is pointing to one particular SHA (ex 62726c
) of that submodule.
So each time on running git submodule update --init
the submodule directory is showing the changes of that SHA (62726c
) only.
Recently I made change to the submodule and pushed the changes SHA (f81611
) but as mentioned above the HEAD of the submodule is still pointing to old SHA 62726c
.
When doing git submodule update --init
, you checkout the submodule to the revision registered by the project, which hasn't been updated, that's why you always see it reverted.
To change the revision of the submodule for the super project, check out the submodule to the SHA1 you want:
git checkout f81611
From the main project you'll see that the submodule is listed as being modified (git status
). You need to commit this modification, as if the submodule was a normal file:
git add <path-to-submodule>
git commit -m "Update submodule XX so that it does YY"
The other option is to make your submodule follow a particular branch:
See "Git submodules: Specify a branch/tag"
Then a git submodule update --init --recursive --remote
would be enough to check out the latest from that branch for all your repos which have specified a branch to follow.
If your pushed change SHA (f81611
) was push on master
of the repo, then git submodule update --init --remote
would update the content of that submodule repo as used in the main parent repo.
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