How to manage git branches with different db schemas?

I have a project where I need to work on a new feature that requires part of the database to be re-designed whilst also keeping the main development branch working on the old schema.

What is your best-practice for managing a project like this?

  • How do I manage changes to my db across git branches?
  • Git-backed ORM for Python?
  • Database issue (orphaned migrations) when using git flow branches
  • Testing and Managing database versions against code versions
  • Backup database along with database-related files
  • Syncing magento database froms development to production
  • I thought about having a separate database whilst working on the new feature but realised this would require having the database config checked into the repository which is a no-go. Are there other ways I could approach the issue?

    Seed data to the rescue

    Right after posting this the answer hit me – I should have some scripts to populate my db with seed data. That way I can just drop/recreate/seed the database when switching between branches.

  • How do I get git to ignore my csv files?
  • How to remove duplicated commits in a git svn tree?
  • Git: push a different changeset to heroku
  • How do I set ssh credentials for libgit2/libssh2?
  • Clone a repo with submodules: override credentials
  • Is it possible to determine whose code (according to `git blame`) was affected by each hunk output by `git diff`?
  • One Solution collect form web for “How to manage git branches with different db schemas?”

    The usual way to deal with this is to check your database creation scripts into source control. Then you can branch and manage them in the same way as the rest of your source code.

    You will need a way of pointing your code at a particular instance of a database (which has been created using the scripts in the current branch).

    Git Baby is a git and github fan, let's start git clone.