撤消 git add --all

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28011104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:49:00  来源:igfitidea点击:

Undo git add --all

gitgit-add

提问by BendEg

I made a mistake and called git add -all, now all files are added. I did not make a commitand push. How can I undomy action?

我犯了一个错误并调用了git add -all,现在所有文件都已添加。我没有做commitpush。如何撤消我的操作?

回答by Simone Carletti

It has already been answered several times:

已经回答过好几次了:

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.

您可以使用git reset. 这将“取消暂存”您在上次提交后添加的所有文件。

如果您只想取消暂存某些文件,请使用git reset -- <file 1> <file 2> <file n>.

还可以使用 .unstage 取消文件中的某些更改 git reset -p

See

回答by nitishagar

To reset specific files you can use: git reset -- <file_a> <file_b>or to reset all your changes you can use git reset.

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