I Lost a Working n8n Workflow to a Bad Edit — Now Git Versions Every Deploy
Description and use
The author built a nightly exporter that snapshots every n8n workflow into a git repository, stripping noise fields and committing only on real changes. This enables quick rollbacks and reduces recovery time from 40 minutes to 20 minutes per month.
Problem
A bad edit of an n8n workflow caused a client to receive 200 un‑triaged emails, and the author had no reliable way to revert the change.
Outcome
The exporter provides reliable rollback, reduces recovery time from 40 minutes to 20 minutes per month, and prevents accidental loss of workflow logic.
Workflow
- 1. Cron trigger at 23:00 daily
- 2. HTTP node GET /api/v1/workflows to fetch all workflows
- 3. Code node removes updatedAt, createdAt, versionId, webhookId from JSON
- 4. Write each workflow to workflows/
<slug>.json and a manifest.json - 5. Execute node runs git diff --quiet; if changed, commit with descriptive message and push
Evidence
I added it myself — a nightly exporter that snapshots every workflow into a git repo, so a bad edit is a git checkout instead of a 40-minute guessing game.
The exporter backs itself up too; I've seen enough backup scripts that exclude themselves.
Without this step, every nightly export shows "changes" that are just timestamps, and the git history becomes unreadable.
The drill takes 20 minutes a month. The Friday-night incident took 40 minutes and a client's trust.
- Record date: 2026-10-17T22:41:28.611Z