在代码未提交到远程分支的时候,如果想撤回commit,可以用git reset --soft 操作
1、查看日志
git log
2、提交想对应的id,一般是第一个
git reset --soft commit_id 或者 git reset --soft HEAD^/HEAD~1
小谢第35问:已经 git commit 的代码怎么回退到本地
原文:https://www.cnblogs.com/xieoxie3000question/p/13256089.html