Technology

Git for Infrastructure Engineers: The Commands That Matter

You don’t need to master every Git feature to manage infrastructure as code. These are the commands I use every day, and why.

Abstract illustration of branching changes

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 -p lets 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.

Keep Reading

Related articles

Let’s Talk

Let’s build something reliable together

Open to consulting, speaking and collaboration across SAP administration, cloud infrastructure and cybersecurity — questions are always welcome.