简体   繁体   English

如何将远程标签重新绑定到本地主服务器上

[英]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 远程github存储库现在有一个名为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 我已经完成了一个git checkout tags/8.1.1但我现在处于一个独立的HEAD状态

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 . 在指向tags/8.1.1 detached head ,在该位置创建(本地) 分支 ,例如ver_8_1_1 Then switch to your (local) master and do a normal rebase onto that branch. 然后切换到您的(本地)主服务器并在该分支上执行正常的rebase。

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. 或者,如果你不想去走一走这样,请检查您的承诺是分离的头的哈希 (==提交811标记的哈希值),然后直接做了重订到这一点。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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