Undoing changes with git reset and cherry-picking
Imagine that you’re working on adding a My PORTFOLIO section to your one-page website, but you realize you need to undo some changes or pick specific changes from your project’s history. This is where Git’s reset and cherry-pick features come in handy. It’s like a time machine that takes your project back to a specific point in history before certain changes were made.
Types of git reset
There are three different kinds of git reset
. We will explain all of them:
- Soft reset: The
git reset --soft
command moves your project back but keeps your recent changes in the staging area (like keeping your unsaved work). You can then re-commit if you want. - Mixed reset: The
git reset --mixed <SHA>
command is the default reset. It moves your project back to a previous state (the state is identified by a unique code called SHA) and puts your changes in the working directory, unsaved. You can then decide...