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?

  • Database structure and source control - best practice
  • Managing My Database in Source Control
  • Mechanisms for tracking DB schema changes
  • Database source control with Oracle
  • Stored procedures/DB schema in source control
  • How can I put a database under git (version control)?
  • 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.

  • What's the difference between `git fetch` then `git rebase`, and `git pull --rebase`?
  • Pushing from GitHub to a Web Server
  • How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?
  • reverting push'd git commit
  • understanding commits in git?
  • Is it possible to make git aware of an existing gitmodules file?
  • 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.