git-undo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git Undo

Git 撤销操作

Undo the last commit but keep changes staged.
  1. Undo the last commit but keep the file changes in the staging area.
    • Command:
      git reset --soft HEAD~1
    • This allows you to fix the commit message or add missing files before committing again.
撤销最后一次提交,但保留暂存区的更改。
  1. 撤销最后一次提交,同时将文件更改保留在暂存区。
    • 命令:
      git reset --soft HEAD~1
    • 你可以在再次提交前,使用该命令修改提交信息或补充遗漏的文件。