Git hygiene with agents
For engineers
Small commits, safe branches and reverts, honest PR descriptions and git rules agents actually follow
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
An agent finished a task and the tree has a bug fix, a rename and a formatter run. What is the best way to commit?
Check yourself · 2 of 5
A bad agent commit is already merged into main. What is the safest way to undo it?
Check yourself · 3 of 5
What is the best way to treat an agent-written PR description?
Check yourself · 4 of 5
Why put git rules in an agent's memory file?
Check yourself · 5 of 5
A secret key was pushed in a commit. What comes first?
Topics
- Small focused agent commits5 min read · One logical change per commit, committed after each green step, staged by explicit path rather than everything
- Branches and reverts as safety nets5 min read · A branch per agent task, revert versus reset, and never rewriting history other people or agents share
- Honest PR descriptions for agent work5 min read · What changed, why, how it was verified, what is untested, and catching agent claims the diff does not support
- Git rules in agent memory files5 min read · Commit message format, attribution trailers, staging rules and forbidden commands written where the agent reads them
- Keeping secrets and junk out of commits5 min read · Env files, keys, logs and build output in agent commits; ignore rules, secret scanning, push protection and rotation
Start here
- Pro Git book (opens in a new tab)BookFree
The full reference for staging, branching, reset and revert, written by Git's maintainers and community.
- Conventional Commits (opens in a new tab)DocsFree
A short, widely used commit message format you can paste into an agent's rules.
- Push protection (GitHub Docs) (opens in a new tab)DocsFree
How GitHub blocks pushes that contain secrets, and what to do when a push is blocked.
Helps to know first
110 questions · last verified 2026-12