Challenges

Real-world Git problems. No step-by-step instructions: just a scenario, a mission and a repository that needs you.

Basics

Repositories, staging and commits.

01beginner

First Commit

Put the project under Git with a single commit holding the site, keep debug.log out of history for good, and leave a clean working tree.

  • git-init
  • staging
  • commits
  • gitignore
Start

Branching

Branches, HEAD and moving between them.

02intermediate

Wrong Branch

Move both login commits onto a new branch called feature/login, and put main back where it was before you started.

  • branches
  • reset
Start
03intermediate

Detached HEAD

Make sure both commits survive on a branch called fix/rounding, then get back to main.

  • detached-head
  • branches
  • head
Start
04intermediate

Uncommitted Changes

Merge hotfix/rounding into release, then get back to main with your unfinished price work exactly as it was, not committed, and nothing left stashed.

  • stash
  • branches
  • merging
Start

Conflicts

When two changes collide.

05intermediate

Merge Conflict

Bring release/2.0 into main with a merge commit. Keep the new host and the longer timeout, decide what happens to the setup guide, and finish on main with nothing left uncommitted.

  • merge-conflicts
  • merging
Start
06advanced

Resolve a Rebase Conflict

Put feature/retries on top of the current main while keeping the new region and the higher retry count in src/settings.js. Finish on the feature branch with no conflict or local change.

  • rebase
  • conflicts
  • conflict-resolution
Start

Recovery

Undoing mistakes and finding lost work.

07beginner

Undo Last Commit

Rewrite the last commit so that config.js is committed but secrets.env never was, ignore secrets.env from now on, and keep history to two commits.

  • reset
  • gitignore
  • history
Start
08intermediate

Lost Commit

Bring feature/payments back with both of its commits, without touching main.

  • reflog
  • branches
  • recovery
Start
09intermediate

Recover Stashed Work

Visit main, then return to feature/invoice-notes with the invoice edit still modified and uncommitted, your launch draft restored as an untracked file, and no work left in the stash.

  • stash
  • branches
  • untracked-files
Start
10intermediate

Revert a Shared Change

Turn the unfinished checkout back off while preserving the faulty commit, the earlier export work, and the shared history. Leave main clean.

  • revert
  • shared-history
  • recovery
Start
11intermediate

Recover a Deleted File

Restore the deployment checklist with its original contents, preserve the newer health endpoint work, and leave the restoration recorded on a clean main branch.

  • restore
  • history
  • recovery
Start

History

Copying and reshaping commits.

12intermediate

Cherry-Pick One Fix

Get the crash fix into release/1.4 without bringing any of main's new features along.

  • cherry-pick
  • branches
Start
13advanced

Clean Up History

Replace the four messy commits with a single commit called Add search, keeping the final code exactly as it is.

  • reset
  • history
  • squash
Start
14advanced

Rebase a Feature Branch

Put both notification commits directly on top of the current main, keep main exactly where it is, and finish on feature/notifications with a clean working tree.

  • rebase
  • branches
  • history
Start
15advanced

Split a Mixed Commit

Replace the mixed commit with Add analytics service, changing only the service file, followed by Document analytics service, changing only the guide. Preserve both files and finish clean.

  • reset
  • staging
  • history
Start

Advanced

Several problems at once.

16advanced

Repository Recovery

Restore main with Add invoice PDFs, bring back feature/reports with its commit, commit the stashed dark-mode work on main as Add dark mode, and leave the stash empty and the working tree clean.

  • reflog
  • stash
  • reset
  • branches
Start
17advanced

Repair Reset Branches

Restore each branch to its own completed commit without moving the other branch, then finish on feature/catalog with a clean working tree and both pieces of work reachable.

  • reflog
  • reset
  • branches
  • recovery
Start