Reputation: 3185
I want sync all tags which name is ver*, I tried following command but it fetched tags which name is not ver*
git fetch --tags --prune --prune-tags --force origin '+refs/tags/ver*:refs/tags/ver*'
Any idea?
Upvotes: 0
Views: 243
Reputation: 52236
Two points :
--tags
is equivalent to adding refs/tags/*:refs/tags/*
on your command line, and will fetch all tagsYou should drop that option
git fetch
will download any tag that points to any commit in the history of the refs you fetchosexp-test
tag pointing to a commit which is part of the history of ver-1.1
, then that tag will also be fetched.To cancel this beavior, use the --no-tags
option
git fetch --no-tags --prune --prune-tags origin '+refs/tags/ver*:refs/tags/ver*'
The default behavior is documented in git help tag
(second paragraph of the Description
section) :
By default, any tag that points into the histories being fetched is also fetched; the effect is to fetch tags that point at branches that you are interested in. This default behavior can be changed by using the
--tags
or--no-tags
options or by configuringremote.<name>.tagOpt
.
Upvotes: 2