从存储库中删除奇怪的“Iconr"文件 [英] Remove weird 'Iconr' file from the repository

查看:23
本文介绍了从存储库中删除奇怪的“Iconr"文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 git 存储库中,我在暂存区有一个奇怪的文件,该文件拒绝还原、删除、提交 - 基本上我无法让它消失..

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..

该文件必须是某个在文件夹中放置多年的古老 OS 9 文件.

The file must be some ancient OS 9 file sitting there in the folder for years.

几天前我已经删除了文件系统中的文件,所以现在 git 正在跟踪 Iconr 的删除.

Couple days ago I've removed the file in the file system so now git is tracking the deletion of Iconr.

然而,它卡在那里.

我通过 SourceTree(我的 git UI 客户端)得到的错误是

The error I'm getting via SourceTree (my git UI client) is

fatal: pathspec 'folder/Iconr' 不匹配任何文件

fatal: pathspec 'folder/Iconr' did not match any files

知道如何让 git 完全忘记那个文件吗?

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.

在那里你可以尝试一个 git add -u,然后是一个 git commit,以便在 repo 中注册该文件的删除.
请参阅git status 表示文件已删除但 git rm 表示 error: pathspec '...' 不匹配任何文件" 为例.

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.

您还可以预览 git clean 会提供什么:git clean -d -x -n(如为什么我尝试在 Git 中删除文件夹时没有pathspec"?")

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆