如何在提交前撤消 git add

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14078820/
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-19 07:57:00  来源:igfitidea点击:

how to undo git add before commit

gitversion-control

提问by Surinder ツ

Possible Duplicate:
Undo git add before commit

可能的重复:
在提交前撤消 git add

When i was working on my project I accidently added files using the following command

当我处理我的项目时,我不小心使用以下命令添加了文件

git add file

I haven't yet run

我还没跑

git commit.

How can I undo or remove these newly added files from the commit?

如何从提交中撤消或删除这些新添加的文件?

Please help.

请帮忙。

回答by aragaer

git resetis a literally "undo" of git add- it removes the changes from staged area.

git reset是字面上的“撤消” git add- 它从暂存区域中删除更改。