git

Git Revert? Restore? Reset?

jakeroggenbuck

Jake Roggenbuck

Posted on June 24, 2024

Git Revert? Restore? Reset?

Git revert, restore, reset ???
Here is what they all do.

Git revert

Makes a commit that is the opposite changes of a specified commit.

Changes from commit abc

+ My name is Jake
Enter fullscreen mode Exit fullscreen mode

git revert abc

Creates a commit that removes the line added in commit abc.

- My name is Jake
Enter fullscreen mode Exit fullscreen mode

Git reset

You can unstage changes with git reset <filename>.

Git reset can change the commit history to remove commits when using --hard so be careful with this one!

Git restore

Git restore - restore a given file in your working tree

Want to undo an auto format for a given file?

Run git restore <filename>

💖 💪 🙅 🚩
jakeroggenbuck
Jake Roggenbuck

Posted on June 24, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related