How do you revert ONLY directories in an SVN working copy?

前端 未结 4 2183
说谎
说谎 2021-02-12 22:22

I want to revert a directory and all sub-directories in an SVN working copy so they match the repository but I don\'t want to touch any files i

4条回答
  •  面向向阳花
    2021-02-12 22:39

    On Windows from the command line you could do this:

    for /d /r %i in (*) do svn revert %i
    

    If you call that from a batch file use %%i instead. Please back up first!

    This command is dirty and will go through all directories, even unmodified ones or the ones not under svn. You could use something like this Ruby script to do in a cleaner way:

    `svn st`.split("\n").grep(/^ M\s+(.*)/) { $1 }.find_all { |i| File.directory? i }.each do |i|
      system "svn revert #{i}"
    end
    

提交回复
热议问题