Fix Subversion conflicts

Got a case where you did a @svn up@ and now you have a bunch of conflicts where you just want to overwrite your changes? I’ve got a little bit of Ruby cleverness for you:


  `svn status`.split("\n").grep(/^C/).map { |c| c.scan(/\S+/).last }.each { |c| `svn cat #{c} > #{c} && svn resolved #{c}` }

I run this from @irb@ at the root of my Subversion working directory. It makes me happy.

Update: lord that looks ugly on one line!


  status = `svn status`.split("\n")
  conflicts = status.grep(/^C/)
  files = conflicts.map { |c| c.scan(/\S+/).last }
  conflicts.each do |c|
    `svn cat #{c} > #{c} && svn resolved #{c}`
  end
Adam Keys @therealadam