0
0
Gitdevops~10 mins

Why knowing how to undo matters in Git - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to undo the last commit but keep changes staged.

Git
git reset --[1] HEAD~1
Drag options to blanks, or click blank then click option'
Amixed
Bsoft
Cmerge
Dhard
Attempts:
3 left
💡 Hint
Common Mistakes
Using --hard will discard changes.
Using --mixed unstages changes.
2fill in blank
medium

Complete the command to discard all local changes in the working directory.

Git
git checkout -- [1]
Drag options to blanks, or click blank then click option'
Amaster
BHEAD
Corigin
D.
Attempts:
3 left
💡 Hint
Common Mistakes
Using HEAD or branch names won't discard working directory changes directly.
3fill in blank
hard

Fix the error in the command to undo the last commit completely, including changes.

Git
git reset --[1] HEAD~1
Drag options to blanks, or click blank then click option'
Ahard
Bmixed
Csoft
Dkeep
Attempts:
3 left
💡 Hint
Common Mistakes
Using --soft or --mixed will keep changes, not discard them.
4fill in blank
hard

Fill both blanks to create a command that unstages files but keeps changes in the working directory.

Git
git reset [1] [2]
Drag options to blanks, or click blank then click option'
A--mixed
BHEAD
C--soft
Dorigin
Attempts:
3 left
💡 Hint
Common Mistakes
Using --soft keeps changes staged.
Using origin is a remote, not a commit reference.
5fill in blank
hard

Fill all three blanks to create a command that reverts a commit by creating a new commit.

Git
git [1] [2] -m [3]
Drag options to blanks, or click blank then click option'
Arevert
Bcommit_hash
C1
Dreset
Attempts:
3 left
💡 Hint
Common Mistakes
Using reset deletes commits, revert creates new commits.
Missing -m option for merge commits causes errors.