What Is GitOps?
GitOps is an approach where the desired state of your infrastructure and deployments lives in Git, and automation continuously makes reality match it.
GitOps applies the workflow you already use for code, pull requests, reviews, version history, to operations. The state of your systems is declared in a Git repository, and a tool watches that repository and reconciles the running environment to match.
The core idea
In GitOps, a Git repository holds declarative descriptions of what should be running: which versions, how many replicas, what configuration. An automated agent compares that desired state to the actual state of the environment and applies changes until they match. Git becomes the single source of truth.
How it works
- Declare the desired state in files committed to Git.
- A reconciliation agent watches the repository.
- When the repo changes, the agent updates the live environment.
- When the environment drifts, the agent corrects it back.
An example
To deploy a new version of a service, an engineer opens a pull request changing the image tag in a config file. After review and merge, the GitOps agent notices the change and rolls out the new version automatically. To roll back, you revert the commit, the same workflow in reverse.
Why it appeals
Every change to infrastructure goes through the same reviewed, auditable pull request process as application code. The Git history becomes a complete record of who changed what and when. Because the repository is the source of truth, recovering or recreating an environment is a matter of reapplying it.
Relation to infrastructure as code
GitOps builds on infrastructure as code: it assumes your environment is described declaratively in files. The addition is the continuous reconciliation loop and the insistence that Git, not a human running commands, drives change. The result is operations that are versioned, automated, and self-correcting.
Key takeaways
- GitOps makes Git the source of truth for infrastructure and deploys.
- An agent continuously reconciles reality to the declared state.
- Changes and rollbacks happen through ordinary pull requests.