Git Practice Exercises
Master Git from your first commit to advanced Git internals. Learn commits, branches, merging, rebasing, remotes, tags, history rewriting, recovery, hooks, and Git’s object model through hands-on problems. Every challenge is verified against a real repository, so you learn how Git actually works by using it, breaking it, and fixing it.
Repositories & Commits
Initialize repositories, stage changes, and build a readable commit history.
Project Comes Under Version Control
Begin your Git journey by initializing a repo and performing your first commits.
Snapshot Commit Trail
Build a small project's history one commit at a time.
History Readback
Read an existing project's history and answer questions about its commits.
Chronicle of a New Project
Start a project from an empty folder and grow it into a readable history.
Two Diffs, Two Questions
Learn the difference between Git's two diffs by creating both at once.
Unstage Without Losing Work
Unstage a file without losing your work and commit only what you meant.
What Did That Commit Change
Inspect what past commits changed using diffs and summaries.
Curated Release From a Messy Tree
Untangle a messy working tree into a series of clean commits.
Undoing Changes
Undo mistakes at every level with the right tool. Restore files, amend the last commit, and clean untracked debris safely.
Throw Away Bad Edits
Discard bad working tree edits and bring one file back from an older commit.
Repair the Last Commit
Fix the last commit's message and add its forgotten file without creating a new commit.
Clear Out the Debris
Preview and then safely delete untracked junk while every tracked edit survives.
Workspace Rescue
Rescue a repository with one precise sequence of restores, an amend, and a safe clean.
Branching
Keep separate lines of work on separate branches. Create, switch, rename, and delete branches, and rescue commits from a detached HEAD.
Two Lines of Work
Give each feature its own branch from a shared base and keep their commits apart.
Branch Housekeeping
Rename, safely delete, and force delete branches according to what each one deserves.
Detached but Not Lost
Commit valuable work on a detached HEAD and rescue it onto a real branch.
Branch Topology Overhaul
Reorganize a repository's branches to an exact target topology, rescuing detached work first.
Merging
Learn how to bring branches together with the history shape you intend. Fast forward when nothing diverged, record a true merge when both sides moved, and squash noisy work into one clean commit.
Fast-Forward Delivery
Integrate an ahead branch by fast-forward and see exactly when that stops being possible.
True Three-Way Merge
Join two diverged lines with a real merge commit, and force one even where fast-forward was possible.
Squash Integration
Land a noisy feature branch as one clean commit while the branch itself stays intact.
Integration Day
Land three features with three different history shapes: fast forward, true merge, and squash.
Remotes Basics
Learn how to work through a shared repository. Clone with tracking set up, fetch to observe before pulling to integrate, and publish and retire branches for the whole team.
Clone and Track
Clone a shared repository and see the remote and tracking setup it configures for free.
Fetch vs Pull
See what fetch moves and what it does not, then integrate the fetched work with pull.
Publish and Retire a Branch
Push a new branch with its upstream in one step and delete a delivered branch from the shared repository.
Two-Clone Relay
Drive two clones and a shared repository through a full publish, relay, integrate, and retire cycle.
Configuration & Ignoring
Configure Git, control ignored files, clean up tracked files, and speed up commands with aliases.
Identity at the Right Level
Set a machine-wide identity and a repository-local override, show where each value comes from, and prove which one commits use.
Ignore Rules That Hold
Ignore patterns, a whole directory and a negated exception inside it - then stop tracking an already-committed secrets file while keeping it on disk.
Aliases for the Daily Grind
Define machine-wide aliases for the team's long commands, including one that takes its argument at the call site, and prove each reproduces its command.
Team-Ready Baseline
Deliver the onboarding baseline: identity at the right levels, a complete ignore policy with a working exception, secrets untracked but kept, and the team's aliases.
Merge Conflicts
Learn how to finish a merge that Git could not finish for you. Read the markers and combine both sides by hand, take a whole side when there is nothing to weave together, and abandon a botched attempt cleanly.
Read the Markers
Start a merge that halts on conflicts, read the markers to combine both sides of two files by hand, and conclude the merge as a two-parent commit.
Abort and Retry
Begin a conflicting merge, abandon it mid-resolution, prove the repository came back to its exact pre-merge state, then redo the merge to the correct resolution.
Take a Side Wholesale
Resolve a three-file merge conflict by taking whole sides - local for one file, incoming for another, a chosen side for a binary - and conclude the merge.
Conflict Gauntlet
Abort a botched merge cleanly, then resolve four conflicting files - hand-combined, local side, incoming side and a binary - into one correct merge commit.
Rebasing
Learn how to replay your work on top of someone else's instead of merging it in. Move a branch onto an advanced base, integrate a diverged clone without a merge commit, and transplant only the finished commits.
Replay Over a Moved Base
Replay a feature branch's commits onto an advanced main line, then catch the main line up without a merge commit, keeping history perfectly linear.
Pull Without the Tangle
Integrate a diverged shared history by replaying local commits on top of the fetched tip instead of merging, then make that the default so the next plain pull stays merge-free too.
Transplant With Onto
Replay only the fix commits from an unfinished feature branch onto the main tip, leaving the feature branch and its half-written work behind.
Linear History Mandate
Bring a stranded feature, a pair of misparented fixes and a diverged clone into one straight line - replayed, transplanted and converged without a single merge commit.
Interactive Rebase & History Editing
Learn how to rewrite a branch into the history a reviewer should see. Reorder and reword commits, squash noisy work into reviewable ones, and split a commit that does two things.
Reorder and Reword
Interactively rebase a branch to replay its four commits in the right narrative order and fix two wrong commit messages, leaving every commit's content and the final tree untouched.
Squash the Noise
Collapse a trail of 'wip', 'typo' and 'oops' commits into three reviewable ones, letting two fixup-marked late fixes fold automatically into the different earlier commits they name, with the final tree unchanged.
Split a Fat Commit
Rewrite a branch so one commit that mixes a bug fix with a feature becomes two clean commits, the fix first, with everything stacked above it preserved.
History Ready for Review
Turn a working but unpresentable branch into the exact reviewable sequence - reordered, reworded, noise squashed, marked fixups folded into their targets and a bloated commit split - without changing what it builds.
About this path
This path starts with your first commit and goes on to staging, undoing changes, branching, merging, remotes, merge conflicts and interactive rebase. You work in a Linux terminal, so you should be comfortable running basic commands there. No earlier Git experience is needed. Later challenges have you clean up history before review by reordering, squashing and splitting commits.
Frequently asked questions
4>What will I practice in this path?
10 modules: Repositories & Commits, Staging & Diffs, Undoing Changes, Branching, Merging, Remotes Basics, Configuration & Ignoring, Merge Conflicts, Rebasing and Interactive Rebase & History Editing.
>How many challenges are there, and how hard are they?
40 challenges: 28 easy and 12 medium.
>What does this path run on?
Challenges run on Git 2.47.3 and Linux CLI.
>Do I need to install anything?
No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.
