Infrastructure as code only works if the code is managed well. You don’t need every Git feature — just a small, reliable set of habits.
The daily loop
git switch -c fix/increase-backup-retention
# ...edit files...
git add -p
git commit -m "Increase backup retention to 30 days"
git push -u origin fix/increase-backup-retention
- Branch per change keeps unrelated work apart.
git add -plets you review each change before staging it — a surprisingly good way to catch mistakes.
Seeing what changed
git log --oneline --graph -15
git diff main...HEAD
Undoing safely
git restore path/to/file # discard local edits to one file
git revert <commit> # undo a pushed commit with a new commit
Prefer revert over rewriting history on shared branches — it keeps an honest record of what happened, which is exactly what you want for infrastructure.



