原文: https://stackoverflow.com/questions/2938301/remove-specific-commit
方法:
git rebase -i HEAD~x
其中x为要往前看的commit次数。
会有类似于这样的界面:
在需要撤销的commit前面把pick改为drop,然后保存即可。
最后,如果这个commit已经在remote仓库了,需要:
git push --force-with-lease
因为直接git push --force是比较严重的。
