Git practice
Practice making and sharing a change in a simulated repository. Start by choosing which edits belong in one commit.
Show command hint
Use ↑ and ↓ for command history. Enter git help for supported commands.
Resolve the merge conflict
Working files
Unstaged
Working edits you can stage.
No unstaged changes.
Staged
Changes the next commit will record.
No staged changes.
Undo a commit
Revert creates a new commit that reverses the latest commit.
Commit graph
Inspect a commit snapshot
Branch tips
Your repository
Server · origin
Pull request
Proposed changes
Try a change from a labmate
Add a plot color commit to server main. See what happens to your local branch and to any current review.
About this simulation
Practice with two synthetic files in your browser. Each mission has its own repository for the current visit. Reloading the page starts a new visit. The model supports up to five local branches and 50 commits and shows just the setting changed in each diff. For a real repository, open the local Git lab.
Worked routes
Stage selectively
Save the rule at 0.50 s and the plot color as purple. Stage config/analysis.toml and compare both diffs. Commit the rule with a message explaining the change. The plot stays under Unstaged. Try editing the rule again after staging it and check the two columns of git status -sb.
Merge independent work
Create and switch to criteria at c0. Save, stage, and commit a 0.30 s minimum RT. Switch to main, then save, stage, and commit the purple plot. Look for c0 in the graph and merge criteria into main. The merge commit has two parents.
Resolve a conflict
The mission starts with criteria at 0.30 s and main at 0.25 s. Find their shared ancestor c0 and merge criteria into main. Compare both values, save the intended resolution, stage config/analysis.toml, and commit. Staging is required even if you keep the 0.25 s value already on main.
Share and review
You start on criteria with a local commit. Run git push -u origin criteria, then open the pull request. Read the proposed changes, record your review, and merge on the server. Compare local and server main, switch to local main, and run git pull --ff-only. To see when a review goes stale, add a labmate commit on the server after you record your review.
Recover a change
Save a new minimum RT and stage it. Run git restore --staged config/analysis.toml. Inspect the unstaged edit, then stage it again and commit. Run git revert HEAD and find both commits in Branches.
Command reference
| Command | What it does here |
|---|---|
git status / git status -sb |
Shows staged, unstaged, and unmerged files. |
git diff -- PATH / git diff --staged -- PATH |
Shows unstaged or staged changes. Omit the path for all changed files. --cached also means staged. |
git add PATH / git add . |
Stages the saved working versions. |
git commit -m "Message" |
Records the staging area as a commit. |
git branch / git switch -c criteria / git switch main |
Lists branches, creates and switches, or switches to an existing branch. |
git merge criteria / git merge --abort |
Merges into the current branch or cancels an unresolved merge. |
git log --oneline --graph --all |
Lists locally known commits and their parents. |
git push -u origin criteria |
Pushes a branch and sets its upstream. After that, git push uses the upstream. |
git fetch origin / git pull --ff-only |
Updates remote-tracking references. Pull also advances the current branch when it can fast-forward. |
git restore --staged PATH / git restore PATH |
Unstages an edit or discards the unstaged edit. |
git revert HEAD |
Adds a commit that reverses the latest single-parent commit. |
Now try the real Git lab with the workshop project.