Lesson 1 · Unit 03
Reset, restore, revert
Which of the three trees does each undo move?
What you practise
git restorefor files,git reset --soft/--mixed/--hardas "which trees move",git revertto undo in public,commit --amend
Try a question from this lesson
Pick one
A branch is a pointer to its newest commit. You regret the last commit and have not shared it. What is the simplest way git could undo it?
Correct answer
Move the branch pointer back to the parent
Why
If the branch points at the parent again, the last commit is simply no longer part of the branch. That is all git reset does to history. The commit object is not even deleted.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Three resets
git reset <commit> moves the current branch to that commit. The option decides how far the change reaches.
Soft stops at the branch: your work stays staged. Mixed (the default) also resets the index: your work stays in the files, unstaged. Hard also overwrites the files: the work is gone.
branch index files
--soft moves - -
--mixed moves resets -
--hard moves resets resets11 more exercises in the app
- 2× multiple choice
- 4× type the answer
- 2× fill the blanks
- 1× true or false
- 1× order the lines
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.