Git - rebasing to a particular tag

こ雲淡風輕ζ 提交于 2020-03-17 05:49:04

问题


(This seems like it should be very easy to do, yet I'm coming up empty on searches so far.)

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

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".

(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.)

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)?


回答1:


You would use the following command:

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

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



来源:https://stackoverflow.com/questions/12469855/git-rebasing-to-a-particular-tag

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