How to use version control systems with a CMS
When you're developing a web site using a CMS like Wordpress or Drupal, and you also want to keep track of your changes using git or any VCS, it quickly becomes a royal pain in the ass.
It's easy to track changes on your themes/templates/etc, but there's a lot of stuff that ends up being stored in a register in the database and thus out of reach for our version control system.
The common approach to workaround this problem, is to dump the content of the database onto a file and then track the changes in that file. I find this solution to be suitable for simple setups with few developers/branches, but as soon as you start adding people/branches it generally leads to chaos. And its almost impossible to get automatic merges this way. So the bottomline is: if you need more than snapshots in your version control, don't go this way.
The exact procedure will depend on your combination of CMS/VCS but it's easy:
just avoid the database like the plague. Instead of storing the data directly
on the registers use
include clauses so that each register is associated to
an actual file that can be tracked/merged properly. You'll still need to dump
the database, but in this case it'll only hold the "structure" and the
conflicts will make more sense and be easier to solve.
The cost of this approach is that content in the files won't show up on the CMS' control panel. But then, if you really need this it's pretty easy to come up with a script that puts the data back for releases, and the saner development process is well worth it.