Created
March 24, 2013 18:17
-
-
Save compleatang/5232905 to your computer and use it in GitHub Desktop.
This specifies a new merge strategy called railsschema, along with the necessary command that Git needs to execute to resolve conflicts. The command itself is just a piece of Ruby code that figures out which schema.rb is the most recent one.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[merge "railsschema"] | |
name = newer Rails schema version | |
driver = "ruby -e '\n\ | |
system %(git), %(merge-file), %(--marker-size=%L), %(%A), %(%O), %(%B)\n\ | |
b = File.read(%(%A))\n\ | |
b.sub!(/^<+ .*\\nActiveRecord::Schema\\.define.:version => (\\d+). do\\n=+\\nActiveRecord::Schema\\.define.:version => (\\d+). do\\n>+ .*/) do\n\ | |
%(ActiveRecord::Schema.define(:version => #{[$1, $2].max}) do)\n\ | |
end\n\ | |
File.open(%(%A), %(w)) {|f| f.write(b)}\n\ | |
exit 1 if b.include?(%(<)*%L)'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment