撤消 git 未提交但暂存的文件中的更改

Undo changes in git's uncommitted but staged file

我怎样才能将 make.f90(我试过 git revert)它恢复到以前的版本?

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   make.f90

要放弃阶段性更改:

git reset HEAD make.f90

另一种方式是:

git stash save
git stash drop

您可以存储所有更改,然后再删除它们。