简体   繁体   English

如何使用 git bash 删除 ~$ 文件(在 Windows 上)

[英]How can I remove ~$ files using git bash (on windows)

I don't see the file in explored, even with the "show hidden objects" setting.即使使用“显示隐藏对象”设置,我也看不到探索中的文件。 On the other hand git shows it as untracked files and I found no way to remove it.另一方面,git 将其显示为未跟踪的文件,我发现无法将其删除。

Any ideas?有任何想法吗?

git status
On branch devSQC
Your branch is up to date with 'origin/devSQC'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        pathto/~$crazy file.xlsx

nothing added to commit but untracked files present (use "git add" to track)


ls pathto/
'~$crazy file.xlsx'

git rm -f 'pathto/~$crazy file.xlsx'
fatal: pathspec 'pathto/~$crazy file.xlsx' did not match any files

I know those are windows files for recovery, but windows does not allow to do anything either and I hope git bash is better ;-) See eg here but I hope, I don't need to install additional tools...我知道那些是用于恢复的 Windows 文件,但 Windows 也不允许做任何事情,我希望 git bash 更好;-) 参见这里的例子,但我希望,我不需要安装额外的工具......

I just realized, it is simple to remove those files within bash (of course, it has nothing to do with git...)我刚刚意识到,在 bash 中删除这些文件很简单(当然,它与 git 无关......)

cd path2/
rm -f '~$FHS_Noten STAT_FS2019_TZ17_Noten_Vorlage.xlsx'

git-rm does not work because it git-rm不起作用,因为它

Remove files from the working tree and from the index从工作树和索引中删除文件

so it is not a function to delete files.所以它不是删除文件的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Windows 中的 git-bash 中执行位于带有空格的文件夹(即“程序文件”)中的命令? - How can I execute commands in git-bash in Windows which are located in a folder with spaces ie “Program Files”? 如何在 Windows 上删除 git bash ssh 身份验证 - How to remove git bash ssh authentication on windows 如何在 Windows 上从 git bash 运行 PHPUnit? - How can I run PHPUnit from git bash on Windows? 如何修复 Git bash 无法在 Windows 上工作 - How can I fix Git bash not working on Windows 如何在Windows的Git Bash上使“ man”或“ nano”可用? - How can I make “man” or “nano” available on Git Bash on Windows? 如何在Windows上的Git Bash中使用Pik for Ruby? - How can I use Pik for Ruby in Git Bash on Windows? 如何使用 git bash (Windows) 解压缩文件? - How to unzip a file using git bash (Windows)? 在Windows上使用Git,如何创建显示修改文件,提交消息,作者和日期的报告 - Using Git on Windows, how can I create reports that show modified files, commit messages, author and date 如何在Windows上的Git / IntelliJ中避免文件中的CR? - How can I avoid CRs in files in Git/IntelliJ on Windows? 有没有办法在 Windows 中使用 GIT bash 根据大小拆分多个文件? - Is there a way to split multiple files based on the size using GIT bash in windows?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM