Git Revert? Restore? Reset?
Jake Roggenbuck
Posted on June 24, 2024
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
git revert abc
Creates a commit that removes the line added in commit abc.
- My name is Jake
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>
💖 💪 🙅 🚩
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
tailwindcss Implementing Dark Mode and Theme Switching using Tailwind v4 and Next.js
November 29, 2024