git 不小心提交了,如何退回

# 退回方法:
# 情况一: 本地修改了,没add ,没commit
git checkout HEAD .
#
# 情况二:add了
git reset HEAD
#
# 情况三:commit后
git reset commit-id
#
# 情况四:push了
git revert commit-id 
git  push

# 查看提交历史commit-id
git log
Talk is cheap, show me the code.
原文地址:https://www.cnblogs.com/cidgur/p/8932859.html