Git 取消某个 commit
Git 大约 371 字本地 commit
commit_id
为想要回到的commit
的id
git reset --soft|--mixed|--hard <commit_id>
--mixed
:会保留源码,只是将git commit
和index
信息回退到了某个版本。--soft
:保留源码,只回退到commit
信息到某个版本。不涉及index
的回退,如果还需要提交,直接commit
即可。--hard
:源码也会回退到某个版本,commit
和index
都会回退到某个版本。(注意:这种方式是改变本地代码仓库源码)
commit 已 push 到远程仓库
回退本地代码同时回退线上代码,回滚到某个指定的版本,线上,线下代码保持一致。
git revert <commit_id>
revert
之后再使用git push
推送到远程仓库
阅读 2782 · 发布于 2019-04-18
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Android VideoView 黑屏处理阅读 4381
-
Java 中的反射阅读 704
-
PostgreSQL 数据库角色管理阅读 1476
-
MySQL 内置函数之时间函数阅读 1214
-
JMeter 使用 Loop Controller 进行循环请求阅读 823
-
Kubernetes Pod 控制器 DaemonSet阅读 205
-
MySQL 查看数据储存引擎阅读 740
-
Java 推断资源的 Content-Type阅读 737
-
Linux 编译安装 PostgreSQL阅读 750
-
k3s Helm Error INSTALLATION FAILED Kubernetes cluster unreachable阅读 304