Git基础操作:push提交成功后如何撤销回退,回退代码到某次commit

使用git log 查看提交历史日志,找到需要回滚的commit_id

git log

退到/进到 指定commit的sha码

( 退回后会保留commit_id的提交内容,在这次之后的内容都会丢掉 )

git reset --hard commit_id  

再次push时需要使用 -f 参数

git push -f   
发布了100 篇原创文章 · 获赞 64 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/hl_java/article/details/97391303