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?
CodePudding user response:
Two points :
--tags
is equivalent to addingrefs/tags/*:refs/tags/*
on your command line
You should drop that option
- by default,
git fetch
will download any tag that points to any commit in the history of the refs you fetch
e.g: if you have aosexp-test
tag pointing to a commit which is part of the history ofver-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
.