注意:回退到倒数第二次提交,即把最后一个 reset 了,倒数第二个就是最后一个了 git reset HEAD~1 也可以采用git reset --hard <commit_id> git add xxx 注意:加–amend有两个作用,一是防止多次提交,二是修改commit msg. git commit --amend git push xxx xxx -f (ex. git push origin master)
git reset HEAD~1
git reset --hard <commit_id>
git add xxx
git commit --amend
git push xxx xxx -f
git push origin master