Git 撤销Commit


当文件没有 Push 时,想要撤回 commit 的文件

1.进入项目目录

使用 git Bash Here 打开

2.查看日志

git log

 3.找到想要撤回到的版本:

git reset --hard  加上commit后面那一串值

 4. 如果需要撤回提交到远程仓库的代码,多执行一下下面代码

git push origin master -f    // 注意 master 是你要撤回的分支

 这样就成功了

Git