简体   繁体   English

如何清除标有“?”的文件在'svn状态'?

[英]How do I clear files marked with a “!” in 'svn status'?

I added files to my SVN but didn't commit them (so that they showed up with an "A" flag in 'svn status').我将文件添加到我的 SVN 但没有提交它们(因此它们在“svn 状态”中显示为“A”标志)。 But then I decided to rename them before committing.但后来我决定在提交之前重命名它们。 I meant to add them and commit, but "svn status" shows the files with the old names marked with a "."我的意思是添加它们并提交,但是“svn status”显示了带有“。”标记的旧名称的文件。 and I can't get rid of this?我不能摆脱这个? How do I do it, I even tried "svn delete *" / "svn remove *" in the directory but doing an 'svn status' after this still shows the files (which are not on my local hard drive) with the old names.我该怎么做,我什至在目录中尝试了“svn delete *”/“svn remove *”,但是在这之后仍然显示文件(不在我的本地硬盘上)具有旧名称. marked with a '!'.标有“!”。

When using wildcards ( * ) the “remove” command removes all files that match this wildcard – that is, all files in the directory.使用通配符 ( * ) 时,“remove”命令会删除与该通配符匹配的所有文件——即目录中的所有文件。

But there are none – you've already deleted them.但是没有——你已经删除了它们。 So no files get removed as far as SVN is concerned.因此,就 SVN 而言,没有文件被删除。

You need to remove those files explicitly.您需要明确删除这些文件。 If there are many of them, you can use grep and awk to retrieve the relevant files from the status output:如果有很多,可以使用grepawk从状态 output 中检索相关文件:

svn st | grep `^!` | awk '{ print $2 }' | xargs svn rm

(untested, use carefully!) (未经测试,慎用!)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM