Git tracks changes to code, which is valuable for EAs, indicators and scripts.
For traders who are new to Git, starting with just three commands — commit, log and checkout — already covers most needs. Hosting the repository privately also provides an off-site backup of the code. A short README describing each strategy version adds useful context when results are reviewed months later.
Linking each live deployment to a specific commit hash in your trading journal makes it possible to tell later exactly which code produced which results.
Benefits:
Full history of changes.
Easy rollback to a working version.
Linking code versions to backtest results.
Branches for experiments.
Practical tips:
Commit after each meaningful change, with a clear message.
Yes, and the lesson that took me longest was that the code is only half of what needs versioning. The input files with the parameters change far more often than the logic, and for a while my repository showed nothing changing while live behaviour drifted every week.
Now every set file lives next to the source, and a parameter tweak gets its own commit with the reason in the message. Looking back six months later, a message like widened session filter after two slow Fridays is worth more than any diff.
The edge case that caught me was a compiled file on the VPS that did not match any commit. I had made a quick fix directly in the editor on the server, compiled it and forgotten, so the tag in my journal pointed at code that was not actually running.
The fix was boring but it works. No edits on the server at all, and the deployment step records a checksum of the compiled file next to the tag so I can confirm they match.
Do you version the parameter files too, or only the source? I find most of my confusing results trace back to inputs rather than logic.
FXS Prop Desk, a mild disagreement on branches. For a solo trader I found long lived experiment branches did more harm than good: at one point I had seven of them, five never got merged, and twice I compiled from the wrong one.
Now experiments live behind an input switch on the main branch, off by default. One branch, tags for anything that goes live, and the switch value is recorded in the set file.
On keeping credentials out, the edge case is what happens after a slip. Deleting a file that held an API key in a later commit does not remove it from history, so the only real fix is rotating the key and treating the old one as public.
Another habit that pays off is a build step that writes the short commit hash into a constant before compiling. The EA prints it when it starts, so the journal entry and the running code agree without me typing anything.
How do you handle backtest reports, inside the repository or beside it? Mine are too large to commit, so only a summary file goes in with the hash, date range and a few key stats.
Strategies change constantly. A parameter tweak here, a new filter there. Without version control, nobody remembers which version produced which results.
Git, the standard tool, records every change with a message and timestamp. It allows returning to any previous state, comparing versions, and working on experiments in branches without disturbing the live code. Hosting services provide backup and sharing.
For trading, a few practices help. Commit every change with a clear message, including why. Tag versions that go live, so it's always clear what was running on a given date. Keep configuration, such as parameters and risk limits, in files under version control, not hard-coded. Never commit passwords or API keys, and use environment variables or secret files excluded from the repository.
Linking journal entries to the version in use turns analysis into something reliable: results can be attributed to a specific code state.
Even non-programmers can use version control for documents like trading plans and checklists, with history showing how the rules evolved.
The learning curve is manageable and pays for itself the first time a mistake needs to be reversed.
A small ritual helps: before any live change, create a tag, then run the usual checks. If something goes wrong, rolling back is a single command, not an archaeology project. The first time it saves an afternoon, the habit sticks.
Is version control in use for strategy code or plans, and has it ever rescued a situation?