问题
(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