如何执行“git checkout -b< branchname>”来自远程标签 [英] How to do a "git checkout -b <branchname>" from a remote tag

查看:1149
本文介绍了如何执行“git checkout -b< branchname>”来自远程标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从一个远程标签创建一个分支,但似乎没有办法做到这一点。当我尝试

  git checkout -b test origin / deploy 

其中origin是远程的,deploy是我想查看的标签,但是我得到了

pre > 致命:git checkout:更新路径与切换分支不兼容。
您是否打算签出无法解析为提交的origin / deploy?

更新:
我刚刚发现
p>

  git fetch --all -t 

对我来说工作不正常。当它下载所有分支时,它并不下载所有标签,所以当我检出部署时,它是旧标签。现在我执行

  git fetch --all&& git fetch -t 

通过这种方式,当我创建一个基于标签的新分支

  git checkout -b测试部署

新分支是最新的部署。

我曾经使用过这样的东西,它似乎工作得很好:

  git pull(或fetch,只需要确保您已更新)
git checkout -b测试远程/原始/部署


I'm trying to create a branch from a remote tag, but it seems there's no way to do it. When I try

git checkout -b test origin/deploy

where origin is the remote and deploy is the tag I want to check out, but I get

fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/deploy' which can not be resolved as commit?

UPDATE: I've just discovered that

git fetch --all -t

was not working properly for me. While it downloads all branches, it does not download all tags, so when I checked out deploy it was and old tag. Now I execute

git fetch --all && git fetch -t

This way when I create a new branch based on a tag

git checkout -b test deploy

the new branch is up to date with the last deploy.

解决方案

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

这篇关于如何执行“git checkout -b< branchname>”来自远程标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆