如果要在当前HEAD上提交具有不同提交的确切状态,撤消所有中间提交,则可以使用reset创建索引的正确状态来进行提交。# Reset the index and working tree to the desired tree# Ensure you have no uncommitted changes that you want to keepgit reset --hard 56e05fced# Move the branch pointer back to the previous HEADgit reset --soft HEAD@{1}git commit -m "Revert to 56e05fced"