How to do a “git checkout -b <branchname>” from a remote tag

北城余情 提交于 2019-12-02 21:54:22

I'm not a git guru, but I had used something like this before and it seemed to have worked fine:

git pull (or fetch, just need to make sure you are updated)
git checkout -b test remotes/origin/deploy

I'm not sure you can do this directly. You're probably stuck with doing a fetch and then a checkout:

git fetch origin
git checkout -b test tag-name

By the way, I wouldn't recommend using a tag name like "deploy".

Nagaraj N Hittalamani

You need to run

git pull
git checkout -b <new-branch-name> remotes/origin/<source-branch-name>

to list all the tags

git fetch
git tags -l 

to create a local branch that points to the tag

git checkout tags/<tag_name> -b <branch_name>
git checkout -b <branch_name> tags/<tag_name>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!