Skip to content

Instantly share code, notes, and snippets.

@quinn
Created October 8, 2008 20:29
Show Gist options
  • Save quinn/15578 to your computer and use it in GitHub Desktop.
Save quinn/15578 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# script written by github.com/masover
require 'fileutils'
(base, theirs, mine, target) = *ARGV
files = [mine, base, theirs]
stats = files.map{|f| [f, File.stat(f).mtime]}
system('meld', *files) || raise('Meld died!')
merged_version = stats.find{|f| File.stat(f.first).mtime != f.last}[0]
FileUtils.cp merged_version, target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment