History & Rollback
When a release goes bad, you want the previous version back, fast. GitOps gives you two levers: Argo CD's own rollback to an earlier sync, and a Git revert that changes the desired state. They are not equivalent, and knowing when to use which is a common interview question and a common incident decision.
Argo CD's history
Every successful sync is recorded in the Application's history (by default the last 10, spec.revisionHistoryLimit). Sample session:
argocd app history linkly-productionSOURCE https://github.com/acme/linkly-deploy.git
ID DATE REVISION
4 2026-01-12 14:03:11 +0000 UTC main (8f3e712)
5 2026-01-14 09:40:52 +0000 UTC main (c373fcc)
6 2026-01-15 10:02:37 +0000 UTC main (fd8b880)Rolling back to ID 5 re-applies exactly what was synced then:
argocd app set linkly-production --sync-policy none # rollback refuses to run while auto-sync is on
argocd app rollback linkly-production 5
argocd app get linkly-production | grep -E 'Sync Status|Health Status'Sync Status: OutOfSync from main (fd8b880)
Health Status: HealthyThe app is now healthy but OutOfSync: the cluster runs the old version while Git still says the new one. That's the catch. You had to switch auto-sync off (otherwise the next pass would sync forward again), and until someone fixes Git, the cluster and the source of truth disagree. Anyone who re-enables auto-sync redeploys the bad version.
Git revert: the GitOps-native rollback
Reverting the promotion commit changes the desired state itself, so auto-sync stays on and the history explains what happened. When the bad state came from several commits, revert them together into one commit. Finding them is a git log on the environment's folder:
git init -q linkly-deploy && cd linkly-deploy
mkdir -p apps/linkly/production
printf 'image:\n tag: 1.4.0\nreplicaCount: 3\nlogLevel: info\n' > apps/linkly/production/values.yaml
git add . && git commit -qm "production: linkly 1.4.0" && git tag prod-good
yq -i '.image.tag = "1.5.0"' apps/linkly/production/values.yaml
git commit -qam "production: promote linkly 1.5.0"
yq -i '.logLevel = "warn"' apps/linkly/production/values.yaml
git commit -qam "production: quieter logs for 1.5.0"
echo "--- production history:"
git log --oneline -- apps/linkly/production
# roll back both changes in one commit, without rewriting history
git revert --no-commit prod-good..HEAD
git commit -qm "production: roll back to linkly 1.4.0 (incident INC-142)"
echo "--- after the rollback commit:"
git log --oneline
git diff --stat prod-good HEAD && echo "production matches prod-good exactly"--- production history:
9976f73 production: quieter logs for 1.5.0
6ad8f6d production: promote linkly 1.5.0
2aacefc production: linkly 1.4.0
--- after the rollback commit:
1c8c8e9 production: roll back to linkly 1.4.0 (incident INC-142)
9976f73 production: quieter logs for 1.5.0
6ad8f6d production: promote linkly 1.5.0
2aacefc production: linkly 1.4.0
production matches prod-good exactly
git diff prod-good HEAD printing nothing proves the rollback restored the last good state byte for byte. Never git reset --hard and force-push a GitOps branch: the agent would follow, but the history of what ran in production is gone, and every clone now disagrees with the remote.
Which one, when
argocd app rollback |
git revert |
|
|---|---|---|
| speed | seconds, no review | a commit (and maybe an approval) away |
| auto-sync | must be disabled | stays on |
| Git and cluster agree afterwards | no, until Git is fixed | yes |
| works when Git is unreachable or the bad change is in Git tooling | yes | no |
| audit trail | Argo CD events only | the commit, with a reason |
A sensible runbook: if the fix through Git takes minutes, revert in Git. If production is burning and the Git path is slow (required reviews, a broken CI), roll back in Argo CD as a break-glass step, then immediately make Git match (revert) and re-enable auto-sync. The Field Notes turn this into a checklist.
What a rollback doesn't undo
- Database migrations. Rolling back the image doesn't roll back the schema. A PreSync migration that dropped a column makes 1.4.0 fail even after the rollback. Use expand-and-contract migrations so the previous version always works with the new schema.
- External side effects: messages sent, cache formats, data written in a new format.
- Pruned objects come back only if the old revision contained them; their data (PVCs) doesn't.
- Flux has no
rollbackcommand at all: you revert in Git (orflux suspendand fix by hand). Its helm-controller can roll back a failed Helm upgrade automatically throughspec.upgrade.remediation, covered in The Helm Controller. For canary-style automatic rollback on bad metrics, see Argo Rollouts.
Test yourself
After argocd app rollback linkly-production 5, what does the app's status show?
- Synced and Healthy
- OutOfSync, because Git still describes the newer revision
- Missing
- Degraded
Why must auto-sync be disabled before argocd app rollback?
- Rollback needs a manual sync window
- Otherwise the next reconcile would sync the app forward to Git again
- Auto-sync deletes the history
- It isn't necessary
Why is git reset --hard plus force-push a bad way to roll back a GitOps repository?
- Argo CD can't follow force-pushes
- It erases the record of what ran in production and desynchronises every clone
- Git forbids it
- It's slower than revert