本文介绍了回滚远程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存储库
发布评论