Git-重新标记到特定标签 [英] Git - rebasing to a particular tag

查看:340
本文介绍了Git-重新标记到特定标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(这似乎应该很容易做到,但是到目前为止,我在搜索中还是空的.)

我有一个来自上游源代码的主体,在各个分支上都标注了各种版本.

I have a body of code from an upstream source, with various versions tagged in it on various branches.

我正在基于标记"v1.0"的"develop"分支上工作.从那时起,出现了许多版本,但是虽然"v2.0"很有趣,但我想将我的开发分支重新设置为"v1.5"并继续在那里工作(假设我不打算将其反馈给上游).也许以后再将其重新设置为"v2.0".

I am working on my "develop" branch which was based on tag "v1.0". many versions have come out since then, but while "v2.0" is interesting, I want to rebase my develop branch to "v1.5" and continue working there (assume I don't plan to feed that back upstream). Maybe later I'll rebase it again to "v2.0".

(为此,假定"v1.x"是同一分支上的所有标签.为获得额外的荣誉,我们可以假定"v2.0"是另一分支上的标签.)

(For this purpose assume "v1.x"s are all tags on the same branch. For extra credit we can assume "v2.0" is a tag on another branch.)

我能够很容易地基于"v1.0"标签创建初始的"develop"分支,但是rebase似乎仅适用于分支.一个标签也不能重新设置基准吗?如果没有,那么什么是正确的方法(以便与重新标记到特定标签具有完全相同的效果)?

I was able to create the initial "develop" branch based on the "v1.0" tag easily enough, but rebase appears to only work with branches. Can't one rebase using tags as well? If not, what's the right way to accomplish that (so as to have exactly the same effect as rebasing to a particular tag)?

推荐答案

您将使用以下命令:

git rebase --onto v1.5 v1.0 develop

命令的develop部分必须是分支,但是其他两个可以是您想要的任何内容.

The develop part of the command must be a branch, but the other two can be whatever you want.

这篇关于Git-重新标记到特定标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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