我的 Linux 本地副本中有几个未版本控制的目录。 svn status 没有列出未版本控制的目录。命令 svn status| grep ^?
仅列出版本化目录中的未版本化文件。列出未版本控制的目录及其中的文件的命令是什么?
请您参考如下方法:
想法
svn add
命令将添加未版本控制的文件和文件夹并列出它们。我们确实想列出它们,但我们不想添加它们。因此,我们可以在此之后运行 svn rm --keep-local
以恢复添加(并避免丢弃本地修改)。
详情
运行:
svn add * --force
这将列出您的工作副本中所有未版本化的对象(包括那些具有 svn:ignore
属性的对象)。但是,这也将标记为添加所有这些对象。
为什么需要--force
选项是described in SVN book :
Normally, the command svn add * will skip over any directories that are already under version control. Sometimes, however, you may want to add every unversioned object in your working copy, including those hiding deeper. Passing the --force option makes svn add recurse into versioned directories
然后,只需恢复这些添加并保留本地修改(注意尾随点):
svn rm --keep-local .
为什么需要--keep-local
选项是described in SVN book :
Use the --keep-local option to override the default svn delete behavior of also removing the target file that was scheduled for versioned deletion. This is helpful when you realize that you've accidentally committed the addition of a file that you need to keep around in your working copy, but which shouldn't have been added to version control.
这显然有删除所有添加的副作用,包括那些有意添加的。
在此之后,您应该有一个未版本控制的文件和文件夹列表,以及未触及的本地副本。