Reputation: 4274
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.
Upvotes: 22
Views: 10833
Reputation: 429
git push <remote> tag <tag>
In your case it will be
git push origin tag v2.*
Upvotes: 21
Reputation: 2989
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.Upvotes: 16