exit lab
DevOps learning path
BeginnerVersion Control

Git

The version control system everything else in this roadmap assumes you already know.

45 min

Overview

Git tracks every change to your code as a series of commits, letting you move between versions, branch off to try something risky, and merge work back together without losing history.

Why it matters

Every other tool on this roadmap assumes a Git repository exists: CI/CD triggers on a push, deployments build from a commit, code review happens on a branch. Git isn't optional infrastructure — it's the substrate everything else is built on.

How backend developers use it

Feature branches per unit of work, small commits that each represent one logical change, and pull requests as the review gate before anything reaches main. For a backend service specifically: never commit application.properties with real credentials in it — that's what environment variables and .gitignore are for.

Common mistakes

Warning

Committing secrets (API keys, database passwords) directly into the repository — even one commit in history means the secret is compromised forever, rotation required.

Warning

One giant commit for an entire feature, making code review and git blame nearly useless.

Warning

Force-pushing to a shared branch, silently discarding a teammate's commits.

Warning

Never using .gitignore, so build artifacts (target/, node_modules/, .env) end up tracked and bloat the repo.

Example commands

Stage and commit a change

git add . && git commit -m "feat: add idempotency check to payment endpoint"

Create and switch to a new branch

git checkout -b feature/payment-idempotency

See what changed before committing

git diff

Undo a commit but keep the changes staged

git reset --soft HEAD~1

Temporarily shelve uncommitted changes

git stash

Resources

Retrieval check

Before you continue

  • Explain what this tool or practice changes in the delivery lifecycle.
  • Name one common failure it helps you diagnose or prevent.
  • Repeat one example command from memory, then verify it.