git undo the last commit submission

git revokes the last commit submission (still locally)


1.git reset --soft head~1 (revoking the last commit, will not revoke git add)

2.git reset head~ (Revoke the last commit and cancel git add at the same time)

Git version rollback (git log can view commit_id)

Git版本回退()

1.git reset --hard head^ (回退到上个版本)

2.git reset --hard head~2 (回退到第2个版本)

3.git reset --hard commit_id (回退到指定版本)

head~ 和 head~1效果是一样的
谨慎操作 回退之后就看不到回退版本之前的 commit_id 了

Guess you like

Origin blog.csdn.net/weixin_44953227/article/details/106387824