撤消 git 添加 --all

Undo git add --all

我打错了,调用了git add -all,现在所有文件都添加好了。我没有做commitpush。我怎样才能撤消我的操作?

要重置特定文件,您可以使用:git reset -- <file_a> <file_b> 或重置所有更改,您可以使用 git reset

已经回答了好几次了:

You can use git reset. This will 'unstage' all the files you've added after your last commit.

If you want to unstage only some files, use git reset -- <file 1> <file 2> <file n>.

Also it's possible to unstage some of the changes in files by using git reset -p.

  • How to undo 'git add' before commit?
  • How can you undo the last git add?