• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Dev Tips / git reset vs revert

git reset vs revert

Last updated on November 15, 2021 by Sal Ferrarello

Conceptually, reset is erasing your last change while revert is adding a new change that undoes your previous change.

Imagine we are adding numbers:

8 + 26

and we keep adding additional numbers

8 + 26 + 7

and so on

8 + 26 + 7 + 53

but then we make a mistake and add an incorrect number (in this case we accidentally add 13)

8 + 26 + 7 + 53 + 13

we can either erase our last change (git reset) and pretend it never happened.

8 + 26 + 7 + 53

or we can add a new number that undoes the previous number (git revert)

8 + 26 + 7 + 53 + 13 + (-13)
Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Computing, Dev Tips, Draft Tagged With: Git

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in