Working on Drupal and Drush with teammates I'm currently working on a website using Drupal 8, with 3 other members in my team.

We use git as a versioning system, and we very often work at the same time on different branches.

Here is the problem : 


If we all use local databases, then it's a mess when we have to merge our code, because we have to isolate the parts of the database that have changed, and create a patch, or re-create the changes ourselves a second time.
For example if I have created many static pages, I have to create them again, or export the part of the database containing them.
If we choose to share a database to avoid that problem, then every time someone runs the drush cr command, everyone's website gets synched to their last changes, erasing every other changes from other teammate, which can be very confusing and annoying.


What is the right solution here?
Checkout configuration management in Drupal 8. Though there are many modules that can help you out but most of them are in active development and not stable for production use yet. 

Two most promising modules are Configuration Update module and Features module.

Checkout What are the alternatives to Features module in Drupal 8 for further notes.