已经push到远端之后,想要删除commit,并且保存之前修改
1.git log获取commit信息
2.git reset (commit-id) (想要回退的那个位置的commit id)
3.git push origin 分支名 --force
删除本地的分支
git branch -D [branchname]
删除远程未合并的分支
git push origin --delete [branchname]
在没有进行push之前可以采用如下方法进行commit的撤销
–mixed
git reset HEAD^
不删除工作空间提交的代码,撤销 commit,