如何将master分支还原为git中的标签? [英] How do I revert master branch to a tag in git?

查看:55
本文介绍了如何将master分支还原为git中的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有分支机构的起源和发展. master的初始状态标记为tag_ABC.

We have branches origin and develop. The initial state of master was tagged at tag_ABC.

我们对develop分支进行了很少的更改,并将其推向了起源. 然后,我们无意中将开发合并为大师并推向了起源.

We have few changes made to the develop branch and pushed to origin. Then we have accidentally merged develop into master and pushed to origin.

现在,我们想将主服务器还原到检查点tag_ABC.我们该怎么做?

Now we would like to revert master to the checkpoint tag_ABC. How can we do that?

推荐答案

您可以

git checkout master
git reset --hard tag_ABC
git push --force origin master

请注意,这将覆盖上游存储库中的现有历史记录,并可能给签出此存储库的其他开发人员带来麻烦.

Please note that this will overwrite existing history in the upstream repo and may cause problems for other developers who have this repo checked out.

这篇关于如何将master分支还原为git中的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆