My team faced a similar problem. We use git to version our own custom code such as plugins and the theme that we write. We use Composer to manage dependencies such as plugins we did not write. We check the composer.json and composer.lock files into git to keep everyone in sync. Each developer is expected to pull the git master branch and run
composer update on their playpens frequently so everyone remains up to date.
In the database, the developers mainly care about configuration, and we often use WP-CLI to keep configuration in sync. For example, we have a shell script that runs a WP-CLI command to enable or disable plugins on a per-host basis; some plugins are only used on our content staging host, for example, so the script can be run on any host and will only enable the appropriate set on that host. Some configuration that is too time consuming to script is just documented and reproduced manually if necessary.
We also have a perl script that will completely clone the database from our content staging server on to a QA or dev host. The devs can use this periodically if they want all the current content, though that's usually less important than having the code and configuration. The script performs these tasks:
- mySQL dump of the content staging server's database, change table names, load into the target server's database
- use wp-cli to change references to the staging server within the database to refer to the target server
- sync the uploads directory on the target server with the content staging server's uploads
There are some promising solutions for actually versioning the database that are coming along quickly. VersionPress and Mergebot are the two I know of and there may be others.
I wrote up more technical details of how we set up WordPress to work with git and Composer on my blog. It was necessary to run with WordPress core in its own directory to make a clean separation between the code we want to maintain in git and WordPress core. We treat WordPress itself as a dependency and manage it with Composer.