How can I reinstall the remote tag to the local master

I cloned a third party open source repository and started working locally by committing a local master.

The remote github repository now has a tag named 8.1.1

What's the best way to reinstall this deleted tag? I want to pull the latest changes from this version only and then replay my changes from above.

I did git checkout tags/8.1.1

, but now I'm in a separate HEAD state

+3


source to share


1 answer


While you point detached head

to tags/8.1.1

, create a branch (local) at that very spot, eg ver_8_1_1

. Then switch to your (local) master and do a normal reboot to 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 do that, check the commit hash of that particular chapter (== commit hash of tag 811) and then redirect to it.

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

      

+2


source







All Articles