Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I rebase from a remote tag onto local master

Tags:

git

git-rebase

I cloned an open source third-party repository and started working locally, committing to local master.

The remote github repository now has a tag called 8.1.1

Whats the best way to rebase from that remote tag? I want to pull in the latest changes from that release only and then replay my changes on top.

I've done a git checkout tags/8.1.1 but am now in a detached HEAD state

like image 510
codecowboy Avatar asked Jun 06 '15 08:06

codecowboy


1 Answers

While being on that detached head pointing to tags/8.1.1, create a (local) branch at that very place, for example ver_8_1_1. Then switch to your (local) master and do a normal rebase onto that branch.

git checkout tags/8.1.1    # you are here
git branch ver_8_1_1
git checkout master
git rebase -i ver_8_1_1

Or if you don't want to go around like that, check your commit hash of that detached head (== commit hash of the 811 tag) and then do a rebase onto that directly.

git checkout tags/8.1.1    # you are here, at commit #aabb11223344
git checkout master        # ignore your checkout completely
git rebase -i aabb11223344  # just like that
like image 162
quetzalcoatl Avatar answered Nov 01 '22 11:11

quetzalcoatl