Git回滚版本并push到远端master

1、查看日志

git log

2、还原最近的版本 ()

--git reset --hard commit-id

如:git reset --hard d84da14bf2743683eca7a015f56114faaa344f42

3、覆盖分支版本

git push -f origin dev

回滚本地master完成后,将回滚后的代码push到远端master,用于覆盖远端master分支,

通过git命令: git push -f origin master

必须有-f,表示强制的意思。

此时,会要求用户输入远端仓库的用户名和密码,用于确认当前用户具有-f的权限。

-push成功后,就可以删除备份的master了。git命令:
git branch -D master_backup

相关推荐
charlee443 小时前
Git使用经验总结8-Git仓库历史记录清除
git·powershell·敏感信息·仓库重置·历史重写
正经教主4 小时前
【Git】Git05-04:Github分支管理与协作流程
git·github
sean9086 小时前
git filter-repo(优秀的 git repo 历史重写工具) 实战
git·repo·工具
hen3y6 小时前
清理 Git 代码库大文件历史记录
运维·git
小Lu的开源日常7 小时前
踩坑日记:为什么Git 突然 Push 不上去了
git·ssh·github
LZ7工作室8 小时前
MAC编程:在MACOS安装和使用 Git 的方法
网络·git·macos·github·个人开发
T***160710 小时前
Git增强现实案例
git·ar
Arva .12 小时前
git常用
git
久莜12 小时前
【Git】使用教程
git
果子火火12 小时前
Git clone couldn‘t connect to server
git