git 撤销commit

提交代码时,一般我们提交代码的步骤是:

git commit -am ''

git fetch

git rebase

git rebase --continue //若有冲突

git push **

有时候发现有很多冲突,而自己改动的不多,可以:

git reset --soft HEAD~1    //撤消上一个commit,但保留add的文件

git stash    //若有未add的改动

git pull     //解决冲突

git stash pop  //若git stash

git commit -am ''

git push **

原文地址:https://www.cnblogs.com/jiangxiaoyaoblog/p/5764134.html