git is quietly doing half the risk management
Think about what an agent session actually risks. It edits files in a working tree. If that tree was clean when it started, the entire session's damage is one diff you can read and one reset you can throw away. Branches cost almost nothing, so every task can live on its own one, and merging stays a human decision made after reading the evidence.
Underneath that sits the layer most people only meet in a crisis: the reflog. Every commit, reset, rebase, and branch move leaves an entry, kept for 90 days by default even when nothing points at it anymore. For a month or three, almost nothing an agent does to your history with everyday commands is actually gone.
We once had to defeat this on purpose: a clean-room experiment required one commit to be truly unfindable. Deleting it took five deliberate steps — remove the remote, delete branches and tags, expire the reflog, garbage-collect, verify. Five steps to lose one commit. That's the strongest endorsement of a safety net we know how to write.
The habits this buys: commit before you hand over the keyboard, because everything uncommitted stands outside the net (an agent deleting an untracked file performs a real, unrecoverable deletion). Give each task its own branch and review by diff instead of watching the session scroll. And remember the holes: side effects beyond the repo — dropped tables, paid API calls, deployments — were never in git's scope. That part stays on you and your permission settings.
Git was designed in 2005 for thousands of mutually untrusting kernel contributors. Turns out that's exactly the design you want under a code generator.
Replies
i appreciate this perspective because Git was built for collaboration but fits agent workflows naturally. one suggestion would be adding clearer tools that show exactly what an agent changed before allowing merges.
i never thought of reflog as an invisible safety for AI work, but it makes sense. would you recommend agents creating temporary branches and cleanup plans automatically after each completed task?