I’m new to Git or anything about version control. Here’s our setup: As a developer I have a local installation of WordPress which is a clone from our master branch in github called master. Each time I make changes, I push them including the mysql dump to master branch. Another developer also has another remote branch based on master. The problem is as we make changes on our own branch, the database change as well. Our routine when it comes to database is, we manually import the mysql dump into whichever database we chose to be overridden. This is very tedious because we have to manually check/compare changes in the databases which in turn slow down the development. So the question is, does Git allow merging of mysql dumps just like how it does with regular files? If not, could you please give me an alternative solution in merging msyql dumps? Or are there ways that would allow us to avoid it completely? Forgive me if I’m not using the terms correctly.
Share
If you store your SQL file directy into your project root, you’ll have the merge available.
Be just careful to make dumps in a way which creates different lines for each insert (I mean INSERT INTO …. (values), (values) …)
If you have a lot of data, I think it’s not such a good idea to store it into your Git repository. On my project, we store only the database structures into it, and we have another file which manage inserts (into Git to easily share it (ok I’m lying, I’m using Mercurial, but does it matters?)). When an insert is done on all envs, we simply delete the corresponding row in order not to have too big files there. The full data is saved (and backed-up) outside version control.