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
- 01Configure Git for OpsTrackStart lab
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
- 02Initialize the OpsTrack RepositoryStart lab
Put OpsTrack under version control and stage its first file — without committing anything yet.
Beginner · 15 min
- 03Create the First SnapshotStart lab
Record OpsTrack's first reviewable history: the README first, then the service — and keep a local secret out of it.
Beginner · 20 min
- 04Inspect Changed, Staged and Committed ContentStart lab
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
- 05Protect Secrets and Generated FilesStart lab
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
- 06Build Atomic Commits with Selective StagingStart lab
An endpoint and a log fix, tangled in one file overnight. Stage hunk by hunk and give reviewers two commits.
Beginner · 25 min
- 07Read Project HistoryStart lab
Answer four questions about OpsTrack's history with evidence from Git, for the team's onboarding page.
Beginner · 20 min
- 08Create a Health-Check Feature BranchStart lab
Kubernetes needs a readiness probe before the staging rollout. Build it on a branch so main stays releasable while you work.
Beginner · 25 min
- 09Compare and Merge Completed WorkStart lab
OPS-110 is approved. Review exactly what the branch changes, merge it into main, and clean up.
Beginner · 20 min
- 10Handle an Urgent Interruption with StashStart lab
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
- 11Resolve a Content ConflictStart lab
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
- 12Resolve a Modify/Delete ConflictStart lab
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
- 13Compare Fast-Forward and Three-Way MergesStart lab
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
- 14Publish OpsTrack to the Team RemoteStart lab
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
- 15Clone and Join an Existing ProjectStart lab
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
- 16Fetch Before IntegratingStart lab
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
- 17Handle a Diverged BranchStart lab
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
- 18Publish a Feature for ReviewStart lab
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
- 19Rebase Unpublished Work onto Updated mainStart lab
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
- 20Cherry-Pick an Approved ContributionStart lab
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
- 21Restore the Correct Git LayerStart lab
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
- 22Compare Soft, Mixed and Hard ResetStart lab
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
- 23Revert a Shared Production ChangeStart lab
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
- 24Recover a Deleted Branch with the ReflogStart lab
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
- 25Clean an Unpublished Branch with Interactive RebaseStart lab
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
- 26Prepare Annotated Release v1.0.0Start lab
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
- 27Publish and Verify the Release TagStart lab
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
- 28Apply .gitattributes and Line-Ending ConsistencyStart lab
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
- 29Add a Local Pre-Commit Quality GateStart lab
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
- 30Use Git Worktrees for Concurrent WorkStart lab
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
- 31Manage a Pinned SubmoduleStart lab
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
- 32Search History with grep, log -S and log -GStart lab
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
- 33Investigate a Line with git blameStart lab
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
- 34Find a Regression with git bisectStart lab
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
- 35Reuse Conflict Resolution with git rerereStart lab
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
- 36Recover OpsTrack and Publish v1.1.1Start lab
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
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.