Skip to content

Instantly share code, notes, and snippets.

@ndbroadbent
Forked from tpope/.gitattributes
Created January 11, 2012 08:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndbroadbent/1593732 to your computer and use it in GitHub Desktop.
Save ndbroadbent/1593732 to your computer and use it in GitHub Desktop.
Fewer conflicts in your Rails apps
Gemfile.lock merge=bundleinstall
db/schema.rb merge=railsschema
[merge "bundleinstall"]
name = runs bundle install to generate Gemfile.lock
driver = bundle install
[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