SVN command to delete all locally missing files

后端 未结 12 2391
说谎
说谎 2020-12-12 09:13

In SVN is there a command I can use to delete all locally missing files in a directory?

Or failing that, some way of listing only those files that are missing (or, i

12条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 09:59

    If you are using TortoiseSVN, just do a Check for Modifications, sort by the Status column, select all the entries marked missing, right-click to open the context menu, and select Delete. Finally, commit to publish the changes to the repository.

    If you are on Windows, but prefer the command-line and enjoy dabbling in PowerShell, this one-liner will do the trick:

    svn status | ? { $_ -match '^!\s+(.*)' } | % { svn rm $Matches[1] }
    

    That is, filter the output to only those lines showing missing files (denoted by an exclamation at the start of the line), capture the associated file name, and perform an svn rm on that file name.

    (Blog post Remove all “missing” files from a SVN working copy does something similar for Unix/Linux.)

提交回复
热议问题