Loading

git 撤销最近的提交

git commit -m "Something terribly misguided" # (0: Your Accident)
git reset HEAD~                              # (1)
# 此时已经撤销最近一次的提交
# 重新编辑文件                                  # (2)
 git add .                                        # (3)
git commit -c ORIG_HEAD              # (4)

参考

https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git

posted @ 2025-06-30 18:22  lif323  阅读(10)  评论(0)    收藏  举报