reset
git log 查看提交記錄
git reset --soft commit_id
git push origin master --force
然後如果當前存在衝突
git pull
git push
rebase
- 找到要提交的記錄id,類似
1ed361d6bf331cb3e9fc695888d7ae76ae9dce59
的一串字符串; - 執行命令:
git rebase -i 1ed361d6bf331cb3e9fc695888d7ae76ae9dce59
- 找到要刪除的記錄,將前面的
pick
改爲drop
; - 查看記錄
git log
已經刪除成功;