Fetch a single tag from remote repository

前端 未结 3 1257
醉话见心
醉话见心 2020-12-24 05:29

This command fetches all tags:

git fetch origin --tags

This command fetches a specific tag:

git fetch orig         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 06:01

    I read all the answers, but there is not yet mentioned one syntactic sugar. If you need to fetch only one tag as a tag (to checkout later) you can write, for instance for refs/tags/2.3.18:

    git fetch origin tag 2.3.18 --no-tags
    

    This is shortcut for already mentioned:

    git fetch origin refs/tags/2.3.18:refs/tags/2.3.18 --no-tags
    

    Of course, you may not use --no-tags if you need other tags (according to the default behavior) or if you already explicitly set --no-tag in the clone command or in tagOpt config option(man git-clone).

    git fetch origin tag 2.3.18
    

提交回复
热议问题