从存储库中删除怪异的'Iconr'文件 [英] Remove weird 'Iconr' file from the repository
问题描述
在我的git仓库中,我在暂存区域有一个奇怪的文件,它拒绝被还原,删除,提交 - 基本上我无法让它离开 ..
这个文件必须是一些古老的OS 9文件,放在这个文件夹里好几年。
几天前我已经移除在文件系统中的文件,所以现在git正在跟踪删除 Iconr
。
然而,它停留在那里。
我通过SourceTree(我的git UI客户端)获取的错误是:
fatal:pathspec'folder / Iconr'与任何文件都不匹配
任何想法如何让git 完全忘记关于该文件?
最好还是回到命令行以获得更精确的错误消息。
你可以试试 git add -u
,后面跟着一个 git commit
,以注册删除该文件的回购。
请参阅 git status
说文件被删除,但是 git rm
说错误:pathspec'...'没有匹配任何文件
作为例子。
您还可以预览git clean会给出什么: git clean -d -x -n
(如为什么没有pa当我尝试删除Git中的文件夹时,thspec?))
另一个问题是在当前分支中根本没有跟踪该文件,但在另一个分支中被追踪。请参阅回答以检查是否属实。
In my git repository I've got a weird file in the staging area that's refusing to be reverted, removed, committed - basically I can't make it go away..
The file must be some ancient OS 9 file sitting there in the folder for years.
Couple days ago I've removed the file in the file system so now git is tracking the deletion of Iconr
.
However, it's stuck there.
The error I'm getting via SourceTree (my git UI client) is
fatal: pathspec 'folder/Iconr' did not match any files
Any idea how to make git completely forget about that file?
It is best to revert to the command line in order to have a more precise error message.
There you can try a git add -u
, followed by a git commit
, in order to register the deletion of that file in the repo.
See "git status
says file is deleted but git rm
says error: pathspec '…' did not match any files
" as an example.
You can also preview what a git clean would give: git clean -d -x -n
(as explained in "Why is there no "pathspec" when I try to remove a folder in Git?")
The other issue is when that file isn't tracked at all in your current branch, but is tracked in another branch. See that answer to check if that is the case.
这篇关于从存储库中删除怪异的'Iconr'文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!