GIT pull/fetch from specific tag

前端 未结 2 1774
轮回少年
轮回少年 2021-02-01 18:49

Is there a way to pull/fetch code from a specific tag in a repo.

Am aware that after clone, i can checkout to the tag but is it possible to specify a tag during a pull?<

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-01 19:30

    Pull is fetch + merge.

    Talking about how to fetch a specific remote ref (either a tag or branch), probably an example is better at clarifying this:

    git fetch origin :refs/remotes/origin/master
    

    Or a shorter form:

    git fetch origin :remotes/origin/master
    

    Note this works even if remotes/origin/master has been removed locally.

    Another example for creating a local branch directly from a remote tag

    git fetch  +refs/tags/:
    

提交回复
热议问题