我意识到这是一个旧查询,但是..。现在可以轻松完成:
svn revert -R --remove-added /path/to/dir && svn cleanup --remove-unversioned /path/to/dir
第一部分递归恢复更改,并删除添加但未提交的文件。
第二部分删除路径中所有未版本化或忽略的项目。
上述信息的最佳来源。我知道的是 svn 客户端本身:
❯ svn help revert
revert: Restore pristine working copy state (undo local changes).
usage: revert PATH...
Revert changes in the working copy at or within PATH, and remove
conflict markers as well, if any.
This subcommand does not revert already committed changes.
For information about undoing already committed changes, search
the output of 'svn help merge' for 'undo'.
Valid options:
--targets ARG : pass contents of file ARG as additional args
-R [--recursive] : descend recursively, same as --depth=infinity
--depth ARG : limit operation by depth ARG ('empty', 'files',
'immediates', or 'infinity')
-q [--quiet] : print nothing, or only summary information
--changelist [--cl] ARG : operate only on members of changelist ARG
--remove-added : reverting an added item will remove it from disk
❯ svn help cleanup
cleanup: Either recover from an interrupted operation that left the working copy locked,
or remove unwanted files.
usage: 1. cleanup [WCPATH...]
2. cleanup --remove-unversioned [WCPATH...]
cleanup --remove-ignored [WCPATH...]
3. cleanup --vacuum-pristines [WCPATH...]
1. When none of the options --remove-unversioned, --remove-ignored, and
--vacuum-pristines is specified, remove all write locks (shown as 'L' by
the 'svn status' command) from the working copy. Usually, this is only
necessary if a Subversion client has crashed while using the working copy,
leaving it in an unusable state.
WARNING: There is no mechanism that will protect write locks still
being used by other Subversion clients. Running this command
without any options while another client is using the working
copy can corrupt the working copy beyond repair!
2. If the --remove-unversioned option or the --remove-ignored option
is given, remove any unversioned or ignored items within WCPATH.
Note that the 'svn status' command shows unversioned items as '?',
and ignored items as 'I' if the --no-ignore option is given to it.
3. If the --vacuum-pristines option is given, remove pristine copies of
files which are stored inside the .svn directory and which are no longer
referenced by any file in the working copy.