简体   繁体   中英

Submodule tags are not updated with git submodule repository URL update

I have to update the repo URL of a submodule used in my main repo. These are the steps I've followed.

1) Modify the repo URL in .gitmodules file.

2) Run git submodule sync (Then .git/config got updated with the new URL)

3) Then i executed the below command:

git submodule update --init --remote -- <path-to-submodule-folder>

After this i got the submodule files updated from the new repo URL. But in .git/modules/<path-to-submodule-folder>/packed-refs file the tags are still of the previous repo only.

For example:

packed-refs before submodule and after submodule are same like below (which are the tags fetched from the previous repo URL):

208058b9ad3fd54caf66a9c9972cfe80d4f4bc13 refs/tags/3.3.3
3dc3a0ea2d0773af4c0ffd7bbcb21c608e28fcef refs/tags/3.3.4
81bdde705cc69776fd63c870581ee0c793d48873 refs/tags/3.3.5
f8d653d1f9329081e017caf6cb9341834a71b6d2 refs/tags/3.3.6
21ae2afd4edaa1b69782c67a54182d34efe43f9c refs/tags/3.3.7

Ideally i should get new tags in packed-refs file after the submodule is updated so that i can checkout to a specific tag in the new repo.

Thanks!

See if you can get those tags by going to the updated submodule subfolder, and do a git fetch --tags

See " Does “git fetch --tags” include “git fetch”? ". A git fetch alone (done by the git submodule update --remote ) would not fetch tags by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM