> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/database-devops/use-db-devops/structure-git-repository/gitops-in-database-devops.md).

# GitOps with Database DevOps

GitOps is an operational framework that brings DevOps best practices (version control, collaboration, compliance, and CI/CD) into the realm of infrastructure and database automation. In the context of Harness Database DevOps, GitOps enables teams to manage schema changes with the same rigor and scalability as application code. You can apply GitOps principles in several impactful ways:

* Store configurations, database schemas, and migration scripts in Git repositories
* Use pull requests and peer reviews to manage and approve changes
* Trigger automated deployments through changes committed to Git

By integrating GitOps into your database lifecycle, you gain traceability, auditability, and reliable deployment workflows across all environments.

### Implementation approaches <a href="#implementation-approaches" id="implementation-approaches"></a>

When adopting GitOps for database management, two primary branching strategies are commonly used:

1. **Environment-by-Branch**: Each environment (for example, dev, staging, prod) has a dedicated Git branch. Changes are promoted by merging from lower to higher environments. Go to [Environment-by-branch development](/database-devops/use-db-devops/structure-git-repository/environment-by-branch.md) to learn how to configure this approach.
2. **Trunk-Based Development**: A single mainline branch (for example, `main` or `trunk`) is used, with pipelines or metadata controlling environment-specific behavior. Go to [Trunk-based development](/database-devops/use-db-devops/structure-git-repository/trunk-based-development.md) to learn how to configure this approach.

{% hint style="info" %}
**TIP**

If you are not currently using a GitOps-based branching approach, Harness recommends adopting **trunk-based development**. It simplifies change management, accelerates delivery, and aligns well with modern CI/CD and database promotion workflows.
{% endhint %}

### Next steps <a href="#next-steps" id="next-steps"></a>

* Go to [Environment-by-branch development](/database-devops/use-db-devops/structure-git-repository/environment-by-branch.md) to set up branch-per-environment promotions.
* Go to [Trunk-based development](/database-devops/use-db-devops/structure-git-repository/trunk-based-development.md) to configure a single-branch pipeline strategy.
* Go to [Create a pipeline in Database DevOps](/database-devops/use-db-devops/deployment-pipeline-configuration/create-a-pipeline.md) to build your first GitOps-driven database pipeline.
