If I understand the question correctly, you simply want to "undo" the git add
that was done for that file.
(如果我正确理解了这个问题,则只想“撤消”对该文件执行的git add
。)
If you need to remove a single file from the staging area, use
(如果您需要从暂存区中删除单个文件 ,请使用)
git reset HEAD -- <file>
If you need to remove a whole directory (folder) from the staging area, use
(如果您需要从暂存区中删除整个目录(文件夹) ,请使用)
git reset HEAD -- <directoryName>
Your modifications will be kept.
(您的修改将被保留。)
When you run git status
the file will once again show up as modified but not yet staged. (当您运行git status
,文件将再次显示为已修改但尚未暂存。)
See the git reset
man page for details.
(有关详细信息,请参见git reset
手册页 。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…