Git状态报告删除的文件仍然存在 [英] Git status reports deleted files which still exist
问题描述
我的Git状态显示我的工作树中所有不正确的文件deleted
,它们仍然存在.
My Git status is showing all files deleted
in my working tree which is incorrect, they are still there.
要解决此问题,我应该执行git reset --hard
,它将所有修改都重置为其他文件.
To resolve it, I should execute git reset --hard
which reset all my modifications to other files.
有什么想法如何解决它或如何发生的吗?
Any idea how to solve it or how did it happen?
git status
输出:
On branch develop
Your branch is behind 'origin/develop' by 15 commits, and can be fast-forwarded.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .gitignore
deleted: v3/.gitignore
deleted: v3/index-test.php
deleted: v3/index.php
deleted: v3/protected/.gitignore
deleted: v3/protected/.htaccess
deleted: v3/protected/Gruntfile.js
以上不是完整的git status
输出.
我正在处理的那些文件没有准备删除.
The above is not the complete git status
output.
Those files that I was working on are not staged for deletion.
推荐答案
如果使用
rm file.name
,如果file.name
已被检入git.然后您实际上应该发出此命令
and if file.name
was already checked into git. Then you should actually issue this command
git rm file.name
告诉git您不再希望它跟踪该文件
to tell git that you don't want it to track that file anymore
这篇关于Git状态报告删除的文件仍然存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!