回滚远程Git存储库

编程入门 行业动态 更新时间:2024-10-25 14:35:54
本文介绍了回滚远程Git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个远程Git仓库,我需要将最后一个 n 提交回滚到冷漠。

git revert< commit> ... ,然后像往常一样按压,保持历史记录不变。

或者你可以用 git reset --hard HEAD〜n 来回滚。如果您推送的是公共或共享存储库,则可能会根据您的原始分支发散和破坏其他工作。 Git会阻止你这样做,但你可以使用 git push -f 来强制更新。

I have a remote Git repository, and I need to roll back the last n commits into cold oblivion.

解决方案

You can use git revert <commit>… for all the n commits, and then push as usual, keeping history unchanged.

Or you can "roll back" with git reset --hard HEAD~n. If you are pushing in a public or shared repository, you may diverge and break others work based on your original branch. Git will prevent you doing so, but you can use git push -f to force the update.

更多推荐

回滚远程Git存储库

本文发布于:2023-11-07 00:44:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565094.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!