Tired of fighting merge conflicts and broken rollbacks in your database deployments? This post shares lessons from real-world projects on why common Git strategies often fail for databases and how switching to a trunk-based, context-aware approach can bring sanity, speed, and confidence back to your release process.
As a developer working closely with both application and database delivery pipelines, I’ve seen how Git hygiene can make or break a release process. While CI/CD for applications has matured significantly, database deployments often remain fragmented and fragile.
One major culprit? Poor Git branching strategies.
Most teams adopt what seems intuitive-a branch for every environment (dev, qa, prod), but this approach introduces more harm than good. Merge conflicts, configuration drift, and manual patching become the norm rather than the exception.
The core thesis is simple: your Git strategy isn't just about version control; it's the backbone of your GitOps and Database DevOps workflows. Choosing the right branching model leads to cleaner automation, faster feedback loops, and safer production changes.
Before diving deeper, let’s clarify three commonly interchanged terms: CI, CD, and GitOps.
You can implement GitOps without a full-blown CD, but GitOps principles are essential for scalable, resilient CD pipelines. GitOps is the connective tissue between development velocity and operational safety.
Common Pitfalls in Git-Based Deployment Strategies
A common pattern is maintaining a branch for every environment:
main/
└── dev/
└── qa/
└── prod/
At first glance, this structure appears clean and organised. However, it doesn’t scale well in practice.
Common issues include:
This strategy reduces reproducibility and creates brittle pipelines, ultimately slowing down delivery and increasing cognitive load.
Another key architectural decision is choosing between push-based and pull-based deployment models.
Having worked in both large enterprises and fast-moving startups, trunk-based development has consistently emerged as the most scalable branching strategy.
For databases, this means storing changelogs in a single branch. There’s no duplication, no conflict. Liquibase contexts or metadata decide where and when a changeset is applied-not the branch structure.
When managing database deployments, creating separate branches for each environment becomes unsustainable. A context-driven strategy delivers safer, cleaner, and more scalable deployments.
With tools like Harness Database DevOps, along with Helm for application delivery, I use environment metadata (not folders or branches) to control where and how changes are applied. This approach:
Databases are fundamentally different from stateless applications:
Without a GitOps foundation, it's nearly impossible to maintain consistency, visibility, or control across database environments.
The ideal setup? A single mainline branch where all changelogs live. Environment-specific changes are defined using OSS Liquibase contexts:
changeSets:
- id: "1"
author: "john-doe"
context: "dev"
description: "Dev-only schema change"
- id: "2"
author: "john-doe"
context: "qa"
description: "QA validation rule"
- id: "3"
author: "john-doe"
context: "prod"
description: "Production-safe update"
This eliminates duplication and enables safe, reusable changelogs across environments.
Using Harness or similar tools, I configure pipelines to:
This ensures consistency and traceability across development stages while reducing risk and overhead.
Automation is critical for production-grade Database DevOps:
Database deployments demand a higher level of toil work and strategy than most teams realise. Moving away from per-environment branching to a trunk-based, context-driven GitOps model enables better scalability, traceability, and release velocity. By combining modern tools like Harness Database DevOps, and Git with a declarative mindset, database changes become as repeatable and reliable as application code.
A clean Git strategy is not just about organisation, it's about resilience, safety, and speed.
Currently, Harness Database DevOps supports Liquibase as the primary tool for database change management. While other tools exist, Harness’s GitOps workflows and automation are optimized for Liquibase’s declarative, version-controlled, and auditable change management model. We plan to add support for leveraging other open source database change tooling in the future-Next up is Flyway support.
Harness Database DevOps allows you to seamlessly reference liquibase changelogs for any supported database from a single CI/CD deployment pipeline, which is actually a benefit over liquibase, since installing the liquibase mongoDB driver breaks liquibase support for other databases.
Not necessarily. Trunk-based does not mean unreviewed changes go straight to production. With approvals, quality gates, and stage-specific context application, you retain control while reducing branching overhead.
Design rollbacks into your changelogs using liquibase rollback blocks or database snapshots. Also consider forward-fix strategies and backup plans as part of your automated pipeline.