Git - Checkout a remote tag when two remotes have the same tag name

前端 未结 4 1520
不知归路
不知归路 2020-11-28 21:49

I had hoped this would work:

git checkout remote/tag_name

but it doesn\'t. This does:

git checkout tags/tag_name

4条回答
  •  旧时难觅i
    2020-11-28 22:36

    There are some questions on my mind:

    • Why should different remotes have different code (in the same tree)?
    • Why does the remote code affect you checking out tags?

    The thing is the following:

    When you check out a tag using git checkout tags/fancytag it will look in your current repository (on your machine) for the fitting tag.

    If you want to checkout a tag from a specific remote you have to fetch it (the tree of the specific remote) first and then check it out.

提交回复
热议问题