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

相关推荐
wh_xia_jun21 小时前
Git 分支合并操作备忘录
git
满天星83035771 天前
【Git】原理及使用(三)(分支管理)
linux·git
像风一样的男人@1 天前
warning: could not find UI helper ‘git-credential-manager-ui‘
git·ui
代钦塔拉1 天前
Git & GitHub 从入门到精通:全流程实战教程
git·github
晚风吹红霞1 天前
Linux下的趣味编程 —— 进度条、Git版本控制与GDB调试实战
linux·运维·git
xlq223221 天前
7.git
git
Ws_1 天前
Git + Gerrit 第六课:commit --amend、Patch Set 与 Change-Id
git
AIMath~2 天前
向github中上传文件过大超过50M怎么办
网络·git·github
AIMath~2 天前
如何将一个新的文件夹使用git 工具提交到github新仓库中
git·github
满天星83035772 天前
【Git】原理及使用(二) (版本回退)
linux·git