Most small teams start with n8n the same way: someone builds a workflow in the editor, it works, and it becomes part of how the business runs. A few months later there are thirty workflows, two people editing them, and no reliable answer to simple questions like "what changed last Tuesday?" or "can we go back to the version that worked?"
n8n's built-in source control is a good answer if your plan includes it. If it doesn't, or you want something you fully understand, a plain Git repository and a small export routine get you most of the benefit. Here is the setup I use for small teams.
What you actually want from versioning
Before choosing tools, be clear about the goal. For a small team it usually comes down to four things:
- History. See what changed in a workflow, and when.
- Rollback. Restore a known-good version quickly when an edit breaks something.
- Review. Let a second person look at a change before it matters.
- Disaster recovery. Rebuild workflows on a new server if the old one disappears.
You don't need a full CI/CD pipeline for any of this.
Step 1: Export workflows as separate files
The n8n CLI can export every workflow to its own JSON file. On a Docker install it looks roughly like this:
docker exec -u node n8n \
n8n export:workflow --all --separate --output=/home/node/backup/workflows/
Mount that folder to the host so the files land somewhere a Git repository can see them. One file per workflow matters: it keeps diffs readable and lets you restore a single workflow without touching the others.
Step 2: Keep secrets out of the repository
Exported workflow JSON references credentials by ID and name, not by the secret values themselves. That makes workflow exports reasonably safe to commit to a private repository. Credentials are a different story. If you export them, keep them encrypted (the default) and store them outside the workflow repository, with access limited to the people who already administer the server.
Also check your workflows for secrets typed directly into nodes: API keys pasted into HTTP Request headers, tokens in Code nodes, passwords in Set nodes. Move those into proper credentials before you start committing. Git remembers everything, including the key you removed in a later commit.
Step 3: Make diffs readable
Raw exports change in noisy ways: node positions move when someone tidies the canvas, and some metadata changes on every save. Two habits help:
-
Format consistently. Run the files through a JSON formatter with sorted keys (for example
jq -S .) before committing, so key order never shows up as a change. - Write real commit messages. "Added retry on CRM node" is useful in six months. "update" is not.
If you want to go further, a small script can strip fields you never care about, such as canvas positions, but don't overdo it. The goal is that a human can read the diff, not that it's perfect.
Step 4: Automate the export
A versioning system only works if it runs without anyone remembering it. A scheduled job on the host (cron or a systemd timer) that exports, formats, commits and pushes once a day is enough for most small teams. Keep the script short:
- Export all workflows to the mounted folder.
- Format each file.
-
git addand commit only if something changed. - Push to a private remote.
You could also run this from n8n itself with a Schedule Trigger and an Execute Command node, but I prefer the host job: if n8n is down, the backup still runs and still tells you something is wrong.
Step 5: Practise the restore
A history you have never restored from is a hope, not a backup. Once a quarter, take one workflow from Git and import it into a test instance:
n8n import:workflow --input=workflow.json
Check that it opens, that credentials map correctly, and that a test execution runs. Write down anything that surprised you. That note is what saves you an afternoon when you need it for real.
House rules that make Git useful
Tools matter less than a few agreements:
- One owner per workflow. The owner reviews changes and decides when they go live.
-
Name workflows predictably, for example
[Sales] Lead intake - webhook, so file names and history make sense. - Duplicate before big edits. Work on a copy, test it, then switch over. The export captures both, and the history shows what changed.
-
Tag releases for critical workflows. A Git tag like
invoice-reminders-v3turns "the version that worked" into something you can name.
Summary
You don't need an enterprise setup to stop losing work in n8n. Export one file per workflow, keep secrets out, format for readable diffs, automate the commit, and test a restore regularly. It takes an afternoon to set up and saves a lot of guessing later.
If you'd like help designing or tidying up a set of n8n workflows for your business, I describe how I work on my n8n automation services page.
Alec Asgari has spent 16 years in IT, the last five in Dubai, building n8n automations, websites and ERP setups for small businesses. More at alecasgari.com.
Top comments (0)