Skip to content

A basic Git merge driver for Rails' db/schema.rb top-version conflicts

License

Notifications You must be signed in to change notification settings

deliciousinsights/rails-schema-merge-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

rails-schema-merge-driver

A basic Git merge driver for Rails' db/schema.rb top-version conflicts.

This is inspired by this gist, and slightly improved upon.

Installing

  1. Grab the merge driver file and save it someplace. This is a Ruby script intended to run in POSIX environments that support hashbang syntaxes and the /usr/bin/env command. In particular, this will not work straight from Cmd or Powershell as-is.
  2. Make it executable (e.g. chmod a+x merge-db-schemas-top-version).
  3. In a relevant Git attributes file (e.g. $HOME/.config/git/attributes or your project's .git/attributes), add the following:
db/schema.rb merge=railsschema
  1. In a relevant Git config file (e.g. $HOME/.gitconfig or your project's .git/config), add the following:
[merge "railsschema"]
  name = Rails schema.db merge driver
  driver = "path/to/the/file" %O %A %B %L %P

(For instance, if you saved the merge driver in /home/tdd/perso/bin, this would read driver = /home/tdd/perso/bin/merge-db-schemas-top-version %O %A %B %L %P).

There! Now you should benefit from this merging for merges and rebases. It likely b0rks on stash applies, tho. Contributions welcome!

Learning more

About

A basic Git merge driver for Rails' db/schema.rb top-version conflicts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages