How do I get a list of all unversioned files from SVN?

后端 未结 5 767
别那么骄傲
别那么骄傲 2020-11-30 20:38

Sometimes you\'re developing and you decide to commit, forgetting you created a few files on your project. Then a few days down the line your buddy gets your build out of Su

相关标签:
5条回答
  • 2020-11-30 21:00

    If you're running on Windows, you could do something similar to Greg Hewgill's answer using PowerShell.

    (svn stat) -match '^\?'
    

    This could be extended pretty easily to find all unversioned and ignored files and delete them.

    (svn stat "--no-ignore") -match '^[I?]' -replace '^.\s+','' | rm
    

    Hope that's helpful to someone!

    0 讨论(0)
  • 2020-11-30 21:04

    Or from the Windows command line:

    svn stat | find "?"
    
    0 讨论(0)
  • 2020-11-30 21:07

    You can use this command to list all paths for not-versioned files:

    svn status | awk '/^?/ {print $2}'
    

    The first part will do an svn status, and then it will redirect the output to AWK which will do simple filter "first character should be '?'" then it will print the second parameter "which is the file path".

    svn status will always not print ignored files. You can add a file or path by adding that path using

    svn propset svn:ignore "PATH OR PATERN"
    
    0 讨论(0)
  • 2020-11-30 21:09

    If some files have had ignore added to their status, they won't show up in svn status. You'll need:

    svn status --no-ignore
    
    0 讨论(0)
  • 2020-11-30 21:23

    Use the svn status command:

    svn status | grep ^?
    

    Files that are not versioned are indicated with a ? at the start of the line.

    If you find that you always have some specific files that should not be added to the repository (for example, generated binaries), you should set up the svn:ignore property on the containing directory so these files won't keep showing up when using svn status.

    0 讨论(0)
提交回复
热议问题