在我们使用git作为版本控制工具进行代码管理之后,经常性的会碰到一个问题:git commit后,如何撤销commit,下面详细讲一下。git add newFilesgit commit -m '新增xx页面'执行commit后,还没执行push时,想要撤销这次的commit,该怎么办?解决方案:我们可以使用命令:git reset --soft HEAD^ 这样就成功撤销了commit。使用git reset --hard HEAD^ 这样连add也撤销了。本栏目推荐文章linux 安装最新版本gitgit bash报错fatal: detected dubious ownership in repository at的解决方法git commit规范Git提交规范如何把已有项目上传到git一段shell代码可用于git部署代码到服务器的操作openEuler欧拉设置git pull免密git常用命令安装篇 —— gitConditional Git Configuration 有条件配置Git信息commit gitcommit git commit信息git git-commit-id-plugin git specified describe commits commit squash merge git 分支commit历史git 模式git命令commit messages commit git quot checkout commit git commit python git 3.8