Thinking About How to Branch with Grafana Git Sync

Thinking About How to Branch with Grafana Git Sync

2025.08.24

Introduction

Last time, I wrote an article titled "Trying out Git Sync announced in Grafana v12".
https://dev.classmethod.jp/articles/grafana-v12-git-sync/#%25E3%2583%2580%25E3%2583%2583%25E3%2582%25B7%25E3%2583%25A5%25E3%2583%259C%25E3%2583%25BC%25E3%2583%2589%25E4%25BD%259C%25E6%2588%2590
While actually using this feature, I felt the way branches are used is somewhat distinctive, so I'm writing this article.
The Git Sync feature is still a preview feature at this point, so there's a possibility that the functionality may change in the future.

For the test environment, I've continued to use the Enterprise version of Grafana.
The version is 12.1.0-pre.

			
			$ grafana -v
grafana version 12.1.0-pre

		

Creating a New Branch

First, let's try the normal flow from creating a new branch to merging via pull request.
Pasted image 20250824205919

First, I prepare a dashboard and save it as the main branch.
I also leave a message as the initial commit.
CleanShot 2025-08-24 at 08.41.02@2x
Next, I edit some panels.
I change Time series to Bar chart and save the dashboard.
When saving, I select Push to new branch in the Workflow and save it as a development branch (develop).
CleanShot 2025-08-24 at 08.44.16@2x
I continue making changes directly in the develop branch.
CleanShot 2025-08-24 at 08.42.55@2x
Now let's check the commit history from GitHub.
CleanShot 2025-08-24 at 08.46.26@2x
We can confirm three commit histories.
Now let's create a pull request and merge it.
A GitHub tab opens, so we create a pull request and merge it.
CleanShot 2025-08-24 at 08.49.15@2x
Up to here is an example of smoothly proceeding to a pull request.
Next, let's look at the parts I was curious about.## Concerns
I was wondering if it's possible to switch branches in Grafana when creating a new branch.
My initial impression was either:

  • Dashboard is created for each branch
  • You can switch between branches

I imagined that you could edit dashboards for each branch, but the actual behavior was a bit different from what I expected.

First, I created a dashboard and then created a new branch.
Currently, there are two branches: main and develop.
CleanShot 2025-08-24 at 08.54.45@2x
Now I'll check if dashboards have increased for each branch.
The dashboards did not increase.
CleanShot 2025-08-24 at 09.10.19@2x
Next, I'll check if I can switch between main and develop.
I'll open the New Branch dashboard I created earlier.
At this point, the dashboard before changes (main branch) is displayed.
CleanShot 2025-08-24 at 09.11.43@2x
I checked various settings, but couldn't find any option to switch branches.
I also checked the documentation, but couldn't find any feature to switch dashboards by branch at this time.

Let's also check the information incorporated into Grafana.
Git Sync can be configured from Administration > Provisioning, so let's take a look there.
You can check the History of each dashboard from the Resources tab.
CleanShot 2025-08-24 at 09.46.23@2x
I made two commits (once in main, once in develop), but only one from the main branch when the dashboard was created is shown.
CleanShot 2025-08-24 at 09.49.34@2x
This means that Grafana only holds information from the main branch.
Pasted image 20250824205728

However, as demonstrated initially, you can edit the dashboard if you leave the new branch created.
Once you close the dashboard, you cannot reopen the dashboard from the new branch, so be careful.
(If you really need to reproduce the dashboard being modified, you could copy and paste the JSON from GitHub.)
Pasted image 20250824205704## My Branch Management Approach
Currently, I was unable to switch dashboards per branch.
Therefore, I thought it might be difficult to develop while managing multiple branches.
My current approach is not to create multiple branches for each feature addition or fix, but rather to create a new branch from the main branch each time, and then submit a pull request at a convenient point when the work is complete.
Pasted image 20250824225458

Summary

This time I tried using Grafana's Git Sync to create branches and modify dashboards. It seems that dashboards are not currently created for each branch, so I feel that some creativity is needed in how to use this feature.
I hope that in the future, features to switch branches will be added.

Also, although I couldn't try it this time, I think that the feature to embed dashboard preview images in pull requests using the Image Renderer plugin could make Git Sync pull requests an important element in dashboard development.
I would like to try this feature and write a blog about it as well.

Share this article

FacebookHatena blogX

Related articles

Grafana Git Syncのブランチの切り方を考えてみた | DevelopersIO