Git UndoLesson 35Free preview
Git Reset
This lesson is part of Git · All levels
Summary
Git resets moves the pointer branch to another commit and can set the fate of changes in the staging and working directory through three modes: soft, mixed, and hard. The soft mode maintains the changes in the staging, the mixed returns it to the unstaged state, and the hard deletes it from the disk. Use --hard only on local changes that you really want to throw away.
Key points
- -soft: commit canceled, change stays in staging
- -mixed: change back to unstaged status
- -hard: changes discarded from the staging and working directory
- Don't reset --hard on a commit that's already published
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.