删除“位于存储库外部”的文件在胃肠道中
我有一个文件在我的 git status 中徘徊,说它已被删除,但是当我尝试 git rm 时,我得到 ***/* **.php 位于存储库外部。它所在的文件夹肯定在存储库中,所以我很困惑!
I have a file that is loitering in my git status
saying it has been deleted, but when I try to git rm
is, I get ***/***.php is outside repository
. The folder it is in is certainly within the repo, so I am confused!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我长期以来一直在解决类似的问题,结果证明一个简单但不直观的开关就是答案。
git add --update
或只是git add -u
将添加修改的文件并删除已删除的文件。
如果您还想添加新文件:
git add --all
或git add -A
将添加新文件、修改文件和删除已删除文件。
感谢Geek Gumbo
对于更严格的文档,请检查 Git SCM
I have struggled with a similar problem for a long time turns out that a simple but not intutive switch was the answer.
git add --update
or justgit add -u
will add modified files and remove deleted files.
And if you want to add new files as well:
git add --all
orgit add -A
will add new files, modified files and remove deleted files.
Kudos to Geek Gumbo
And for more serious documentation check Git SCM
这很奇怪。但也许您只需要提交更改?
git status
列出了已暂存但尚未提交的更改。如果您git commit
您的更改,git status
不应再将该文件列为已删除。That is strange. But perhaps you just need to commit your changes?
git status
lists changes that have been staged but not committed yet. If yougit commit
your changes,git status
shouldn't list the file as deleted anymore.