How to delete pushed commits and revert to old commit?
This question already has an answer here:
I wouldn't recommend deleting commits that are already pushed to a remote. This can lead to much confusion for other contributors. Therefore I'd recommend you to revert the commits locally and then push your results: git-revert Documentation.
If you need to truly delete the commits you should first do git reset --hard COMMIT
has you have already done. To delete the commits on the remote you need to rewrite it's history aswell using git push --force
. You can find further documentation here.
下一篇: 如何删除推送提交并恢复到旧提交?