简体   繁体   中英

Push tags with git subtree push

I have main repo with many sub-repos. If I do some edits to sub-repos, I can push them to sub-repos using the git subtree push --prefix=path/to/code Repo master --squash . Recently, I've added new tag to main repo git tag 1.0 -> git push --tags . Unfortunately, sub-repos don't include this tag. How can I push this tag to sub-repos? I found the following answer , but it doesn't solve my problem, because I can't merge sub-repos to main repo.

Tags are just pointers to commits. If the commit doesn't exist in your sub-repo (which I'm quite sure it doesn't, and shouldn't), then you can't have the tag in your repo either (it wouldn't be pointing to anything meaningful).

The whole point of a sub repository is that you want to treat it as its own repo without reference to the "parent". So if you want a 1.0 tag in your sub-repo, you'll have to create a new tag in your sub-repo named 1.0 , point it to an appropriate commit that exists in your sub-repo, and then push it to the sub-repo's origin.

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