here is the situation i faced. I have a repo containing a submodule. In the repo, i created a new branch to do some editing.
Then i found out i need an updated submodule, so i pulled down the submodule and kept working. I made a commit afterward, and merge the branch back to the master branch.
In the master branch, when i use "git submodule update", the submodule points back to an old version, but not to the updated one in the branch :(
I am wondering if git merges submodules reference? Can anyone help me?
In your branch, after pulling the submodule 'xxx', you need to go back in the parent repo (in the folder which contains your submodule) and do a:
git add xxx
git commit -m "Updated submodule"
That will record an updated special entry of the index memorizing the new SHA1 for submodule 'xxx'.
That is that special entry which needs to be updated when you merge your branch back to master.
If you forget the git add/git commit step in the branch, the merge back to master would keep the special entry unchanged, still referring to the old SHA1.
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