Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - rebasing to a particular tag

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

like image 363
MartyMacGyver Avatar asked Sep 18 '12 03:09

MartyMacGyver


People also ask

How do I rebase a tag?

If they're signed, it's probably easiest to re-create them from scratch, rather than copying. (Then in either case there's a lightweight tag that has to be made to point somewhere, in this case, to the new annotated tag object; for plain lightweight tags, we point the lightweight tag to the rebase commit.)

What does rebase current onto selected mean?

If the remote branch doesn't exist locally, IntelliJ IDEA will silently create a tracked local branch, checkout into it and rebase. Rebase Current onto Selected (for both remote and local branches) to rebase the branch that is currently checked out on top of the selected.


1 Answers

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.

like image 161
Karl Bielefeldt Avatar answered Oct 14 '22 16:10

Karl Bielefeldt