Mastering Git Reset: A Brief Guide for Professional Developers

How do you reset the last Git commit from the command line? Trick question — I use GitHub Desktop. Just kidding! Let’s talk about the differences between Soft, Mixed, and Hard Git Reset.

Dr. Derek Austin 🥳
git happy
Published in
5 min readOct 16, 2023

--

Photo by Brett Jordan on Unsplash

Hello, developer friends! đź‘‹

We all love playing with our Git repos, don’t we? Git plays an integral part in our lives, as it offers a safety net that allows us to make mistakes and learn from them. Today, let’s dive into one of the “whoops, undo” Git commands: git reset, which is similar to but different from its cousin git restore.

What is Git Reset?

The git reset command essentially allows you to rewind the state of our Git repository to a specific point in time. But unlike time travel in sci-fi movies, git reset offers a greater deal of control and precision.

It can seem as sneaky as a mapache 🦝, as it allows us to manipulate the HEAD (current commit), the index, or even the working directory.

The Three Modes of Git Reset

Git reset has three modes: --soft, --mixed, and --hard. Each of these modes determines how the three trees are updated, meaning…

--

--

Dr. Derek Austin 🥳
git happy

Career advice, film reviews, writing tips, and coding with JS / TS, React & Git. Bio: Web dev since '05. BS & MS in Bioinformatics. Doctor of Physical Therapy.