I have a git repo with another repo as a submodule. The submodule is only used in this project. I commited change in the subrepo but the parent repo still references an older revision (Subproject commit 989471..... etc..)
How do I update the parent repo to point to the latest version of the subrepo. Is there a better way to do this so that they stay in sync as I change the subrepo?
After commiting in the submodule, you change directories into the parent repository and do:
git add path/to/submodule
and commit the change. This will update the tracked commit ID. You'll have to do that for every (group of) commit in the submodule.
This is actually quite reasonable, as it's easily possible that the state of the parent directory depends on a certain state in the child repository (e. g. if bundling a library for a program; you might need a specific version for compilation to work), which is why it's smart to track the submodules commit in the parent repository instead of blindly checking out the HEAD of a specified branch.
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