AFAIK, git push --tag
pushes every tags under refs/tags to remote. I want to know if there is a way in git to only push some tags that matches a wildcard or regexp?
For example, my repo has tag v1.0
, v1.1
, v2.0
and v2.1
. I want to only push v2.*
. I tried
git push <repo> refs/tags/v2.*
and got error
fatal: remote part of refspec is not a valid name in refs/tags/v2.*
Of course, I can always do
cd .git && ls refs/tags/v2.* | xargs git push <repo>
But this does not smell gity.
Sharing Tags You will have to explicitly push tags to a shared server after you have created them. This process is just like sharing remote branches — you can run git push origin <tagname> . If you have a lot of tags that you want to push up at once, you can also use the --tags option to the git push command.
Sharing: Pushing Tags to Remote Sharing tags is similar to pushing branches. By default, git push will not push tags. Tags have to be explicitly passed to git push . To push multiple tags simultaneously pass the --tags option to git push command.
Pushing a tag in git to a remote is similar to pushing a branch to a git remote. The only difference is that you need to mention the tag name after the "git push" command as by default this command only pushed the branch.
Git tags label specific commits and release versions in a Git project development. The git push command allows users to export their local commits and tags to a remote repository. In this tutorial, you will learn to create and push Git tags to a remote repository.
git tag | grep '^v2\.' | xargs --no-run-if-empty git push <repo>
.git
may not be directory, it may not be there at all. Submodules have there file pointing to root repository. Or you can have GIT_DIR
set to somewhere else.git push <remote> tag <tag>
In your case it will be
git push origin tag v2.*
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