Git Hands-On Labs

The Git labs put you on a real team working on one project, from its first commit to a production recovery. You branch and resolve conflicts, work with teammates through a protected remote, undo mistakes without losing work, ship releases, and hunt down the commit that broke production with bisect.

What you will practice in the Git labs

  • Working tree, index and commits
  • .gitignore and keeping secrets out
  • Branches and merges
  • Merge conflicts
  • Stash
  • Remotes, push and fetch
  • Rebase and cherry-pick
  • Restore, reset and revert
  • Reflog and recovering work
  • Tags and releases
  • Hooks, worktrees and submodules
  • Blame and bisect
  1. 01
    Configure Git for OpsTrack

    First day on the OpsTrack team: before anyone commits, Git has to know who they are and how this team starts a repository.

    Beginner · 15 min

  2. 02
    Initialize the OpsTrack Repository

    Put OpsTrack under version control and stage its first file — without committing anything yet.

    Beginner · 15 min

  3. 03
    Create the First Snapshot

    Record OpsTrack's first reviewable history: the README first, then the service — and keep a local secret out of it.

    Beginner · 20 min

  4. 04
    Inspect Changed, Staged and Committed Content

    Two unrelated edits, one file each: see exactly what is in the working tree, the index and the last commit, and commit them separately.

    Beginner · 20 min

  5. 05
    Protect Secrets and Generated Files

    A local test run left artefacts behind and someone staged the production env file. Get the secret out and make the repository keep it out.

    Beginner · 25 min

  6. 06
    Build Atomic Commits with Selective Staging

    An endpoint and a log fix, tangled in one file overnight. Stage hunk by hunk and give reviewers two commits.

    Beginner · 25 min

  7. 07
    Read Project History

    Answer four questions about OpsTrack's history with evidence from Git, for the team's onboarding page.

    Beginner · 20 min

  8. 08
    Create a Health-Check Feature Branch

    Kubernetes needs a readiness probe before the staging rollout. Build it on a branch so main stays releasable while you work.

    Beginner · 25 min

  9. 09
    Compare and Merge Completed Work

    OPS-110 is approved. Review exactly what the branch changes, merge it into main, and clean up.

    Beginner · 20 min

  10. 10
    Handle an Urgent Interruption with Stash

    Half-way through metrics work, production needs a config fix now. Park your work, fix main, and pick up exactly where you left off.

    Beginner · 25 min

  11. 11
    Resolve a Content Conflict

    You and Alice changed the same line. Merge her branch, resolve the conflict to the value the team agreed, and keep the rest of her work.

    Beginner · 25 min

  12. 12
    Resolve a Modify/Delete Conflict

    Carol retired a script on main; Bob's branch still edits it. Merge Bob's work, keep the script deleted, and carry his change to where it belongs now.

    Beginner · 25 min

  13. 13
    Compare Fast-Forward and Three-Way Merges

    Two approved branches, one team policy: fast-forward when you can, an explicit merge commit for CI changes. Predict from the graph, then integrate both.

    Beginner · 25 min

  14. 14
    Publish OpsTrack to the Team Remote

    The platform team created an empty shared repository. Connect OpsTrack to it, publish main with tracking, and keep your private experiment private.

    Intermediate · 20 min

  15. 15
    Clone and Join an Existing Project

    Your workstation was reimaged and Carol has cut a release branch. Clone the team repository and set up a local release branch that tracks it.

    Intermediate · 20 min

  16. 16
    Fetch Before Integrating

    Alice is pushing Terraform for a new region. See her work arrive, inspect it before it touches your branch, then integrate with a fast-forward only.

    Intermediate · 20 min

  17. 17
    Handle a Diverged Branch

    You committed a replica change; Bob pushed an Ansible change first. Read the rejected push, integrate both histories, and publish without force.

    Intermediate · 25 min

  18. 18
    Publish a Feature for Review

    Production alert rules go through review. Publish a branch, generate a pull request with Git itself, and answer review feedback with a follow-up commit.

    Intermediate · 25 min

  19. 19
    Rebase Unpublished Work onto Updated main

    Your private log-rotation branch is based on last week's main, and Alice changed the same Ansible play. Replay your commits on top of the team's main and publish a linear branch.

    Intermediate · 30 min

  20. 20
    Cherry-Pick an Approved Contribution

    release/1.0 needs Bob's Cache-Control fix — and nothing else from his branch. Copy exactly that commit, record where it came from, and publish the release branch.

    Intermediate · 25 min

  21. 21
    Restore the Correct Git Layer

    A messy morning: debug junk in a doc, a local tweak staged by mistake, and a deleted script. Fix each one in the layer where it lives, without a commit.

    Intermediate · 20 min

  22. 22
    Compare Soft, Mixed and Hard Reset

    Three disposable clones, three practice commits each. Squash with --soft, uncommit with --mixed, discard with --hard — and see that the reflog still remembers.

    Intermediate · 30 min

  23. 23
    Revert a Shared Production Change

    Yesterday's pushed change to 32 workers ran staging out of memory, and Alice has pushed on top of it. Undo it publicly with a revert — never by rewriting main.

    Intermediate · 25 min

  24. 24
    Recover a Deleted Branch with the Reflog

    A hasty clean-up deleted an unpushed branch with two days of work. Find its commits in the reflog, recreate the branch, and publish it before anything else goes wrong.

    Intermediate · 20 min

  25. 25
    Clean an Unpublished Branch with Interactive Rebase

    Five noisy commits — wip, fix typo, oops — on a private branch. Rewrite them into one feature commit and one docs commit that a reviewer can read, without losing a byte.

    Intermediate · 30 min

  26. 26
    Prepare Annotated Release v1.0.0

    Carol approved 1.0.0. Record the changelog, then mark exactly that commit with an annotated release tag — the object your deployment pipeline will trust.

    Intermediate · 20 min

  27. 27
    Publish and Verify the Release Tag

    The pipeline deploys tags. Publish the release commit and the v1.0.0 tag — and only that tag — then see why a published release tag must never move.

    Intermediate · 15 min

  28. 28
    Apply .gitattributes and Line-Ending Consistency

    Bob committed from a Windows laptop and the smoke test now dies with bash\r. Make the repository — not each laptop — decide line endings, then normalize history from here on.

    Intermediate · 25 min

  29. 29
    Add a Local Pre-Commit Quality Gate

    After the near miss with a secret, the team wants a shared hook that blocks secret-like values and whitespace errors before they are ever committed.

    Intermediate · 25 min

  30. 30
    Use Git Worktrees for Concurrent Work

    Mid-way through Helm edits, Bob's commit breaks the staging probe. Fix it in a second working tree on the team's latest main — without stashing or disturbing your Helm work.

    Intermediate · 25 min

  31. 31
    Manage a Pinned Submodule

    The SRE runbooks live in their own repository. Include them in OpsTrack pinned to the reviewed v2.3.0, not whatever is newest, and publish the pin.

    Intermediate · 30 min

  32. 32
    Search History with grep, log -S and log -G

    Prepare a post-mortem: when did the connection cap appear, when did a flag die, how often did the log format change, and what did the 1.0.0 release actually contain?

    Advanced · 25 min

  33. 33
    Investigate a Line with git blame

    Why is HEALTH_TIMEOUT 2? A move and a whole-file re-indent hide who decided it. See through both, find the reason, and make blame skip the re-indent for the whole team.

    Advanced · 25 min

  34. 34
    Find a Regression with git bisect

    The config check passed at v1.0.0 and fails on main, with dozens of commits between and one that cannot even run. Let git bisect find the first bad commit, keep the evidence, and clean up.

    Advanced · 30 min

  35. 35
    Reuse Conflict Resolution with git rerere

    The rate-limit feature must land on release/1.1 and on main, and both conflict the same way. Resolve it once, let Git reuse your resolution, and publish both branches.

    Advanced · 25 min

  36. 36
    Recover OpsTrack and Publish v1.1.1

    INC-101: since the 1.1.0 rollout, /health answers 404 and the load balancer is draining pods. Protect your own work, find the commit that broke production, ship a minimal, auditable v1.1.1, and get back to what you were doing.

    Advanced · 90 min

View the full course

Why practice Git hands-on?

  • Most people use Git every day and reach for a search engine the moment something breaks. The labs make you break it and fix it yourself.
  • Every lab checks what you actually did in the repository and tells you what is still missing.
  • The course ends with a full incident: protect your work, find the bad commit and ship a hotfix without disturbing your teammates.

Frequently asked questions

Are the Git labs free?

Yes. Register, enrol in the course and start, with no paid plan.

Do I need a GitHub account?

No. Every lab has its own practice repository and team remote inside the lab, and nothing is pushed to your GitHub.

Are they suitable for a beginner?

Yes. The first module starts with configuring Git and a first commit; you only need to find your way around a terminal.