简体   繁体   中英

How can I rebase from a remote tag onto local master

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM