Automatically remove Subversion unversioned files

前端 未结 30 3154
感情败类
感情败类 2020-11-28 18:54

Does anybody know a way to recursively remove all files in a working copy that are not under version control? (I need this to get more reliable results in my automatic build

30条回答
  •  悲&欢浪女
    2020-11-28 18:58

    Linux command line:

    svn status --no-ignore | egrep '^[?I]' | cut -c9- | xargs -d \\n rm -r
    

    Or, if some of your files are owned by root:

    svn status --no-ignore | egrep '^[?I]' | cut -c9- | sudo xargs -d \\n rm -r
    

    This is based on Ken's answer. (Ken's answer skips ignored files; my answer deletes them).

提交回复
热议问题