Last Updated: January 3, 2026
30 quizzes
Discard local changes in a single tracked file and restore it to the last committed version
git src/app.jsClick an option to fill the blank:
Undo the last commit but keep all its changes staged for a new commit
git reset HEAD~1Click an option to fill the blank:
Create a new commit that reverses the changes introduced by a specific commit
git a1b2c3dClick an option to fill the blank:
Remove untracked files and directories that clutter your working directory
git clean Click an option to fill the blank:
Temporarily save modified and staged changes so you can switch branches with a clean working directory
git Click an option to fill the blank:
Which Git area is directly modified when you edit files before staging them?
What does git reset --hard HEAD~1 do?
In a shared repository, which command is safest to undo a bad commit on main?
Which command unstages a file while keeping its changes in the working directory in modern Git?
What is the main difference between git checkout file.txt and git restore file.txt (with default options)?
Order the steps to undo the last commit but keep its changes for editing and recommitting.
Drag and drop to reorder, or use the arrows.
Order the steps to temporarily shelve work, fix a bug on main, then resume the shelved work.
Drag and drop to reorder, or use the arrows.
Order the steps to clean untracked build artifacts after verifying what will be removed.
Drag and drop to reorder, or use the arrows.
Order the steps to revert a specific bad commit in a shared repository.
Drag and drop to reorder, or use the arrows.
HEAD currently points to commit 1234567. What will this command print?
1git rev-parse --short HEADYou are on branch feature-login. What does this command print?
1git branch --show-currentFile config.yml is staged with changes. What will this command print?
1git restore --staged config.yml && echo "done"There is a single stash entry stash@{0}. What will this command print on success?
1git stash drop stash@{0} && echo "dropped"Identify the incorrect command in this attempt to discard local changes and then clean untracked files.
Click on the line(s) that contain the bug.
git statusgit reset --hardgit clean -nfdgit clean fdFind the incorrect step in this workflow to revert a commit and push the change.
Click on the line(s) that contain the bug.
git log --onelinegit revert HEAD~2git push origin HEAD~2git push origin HEADIdentify the wrong command in this attempt to unstage and discard changes to a file.
Click on the line(s) that contain the bug.
git add config.jsongit restore --staged config.jsongit restore --hard config.jsongit statusMatch each command with what it primarily affects.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match each stash-related command to its purpose.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Match the reset mode with its behavior on Git's three areas.
Click an item on the left, then click its match on the right. Click a matched item to unmatch.
Complete the commands to unstage a file and then discard its working directory changes.
git --staged settings.ymlgit settings.ymlClick an option to fill blank 1:
Complete the commands to view and then drop the most recent stash.
git stash git stash stash@{0}Click an option to fill blank 1:
Complete the commands to preview and then perform a clean-up of untracked files and directories.
git clean -fdgit clean -fdClick an option to fill blank 1:
Select the line that indicates the currently checked-out branch while preparing to undo changes.
Click on the line to select.
feature/login* main bugfix/reset-issueSelect the line that shows an unstaged modification which could be discarded with git restore.
Click on the line to select.
On branch feature-apiChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: src/api/client.js no changes added to commit (use "git add" and/or "git commit -a")Select the line showing an untracked file that could be removed with git clean.
Click on the line to select.
On branch mainUntracked files: (use "git add <file>..." to include in what will be committed) build/output.log notes.tmpnothing added to commit but untracked files present (use "git add" to track)