Sync settings with Git repository

Hello everybody,
I have several questions:
I am trying to do sync settings with a git repository.
I searched for information on the Internet for a long time but did not find anything sensible.
The task is as follows:

  1. When you make any changes to grafana, automatically commit them to the repository.
  2. Pull changes from the repository if they were made there, for example, manually.
  3. Setting up several environments (dev, stage, prod), for each environment its own branch in the repository (the settings for connecting to the database are changed for each environment).

Are there solutions for these tasks?

@xcdswe23 ,

This sounds like a fairly complex GitOps / DevOps workflow. Can I ask: what problems with Grafana and its data/configuration management options are you hoping to solve with this workflow? Is this mostly about managing dashboard JSONs?