按照以下步骤来撤销上一次的 commit 和 push。
-
首先使用
git log
命令查看最近的 commit 记录,找到需要撤销的 commit id。 -
使用命令
git reset --hard HEAD~1
将当前分支 HEAD 指向上一个 commit,也就是撤销上一个 commit。 -
使用命令
git push -f
将本地修改强制推送到远程分支。
按照以下步骤来撤销上一次的 commit 和 push。
首先使用
git log
命令查看最近的 commit 记录,找到需要撤销的 commit id。
使用命令
git reset --hard HEAD~1
将当前分支 HEAD 指向上一个 commit,也就是撤销上一个 commit。
使用命令
git push -f
将本地修改强制推送到远程分支。