From the course: Git from Scratch

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

git revert: Undo something

git revert: Undo something - Git Tutorial

From the course: Git from Scratch

git revert: Undo something

- [Instructor] One of the most powerful features of any software tool is the undo button. Make a mistake, hit undo, and it's as if it never happened. That's kind of tricky though when you have an omnipotent, passive observer of all things watching and keeping track of the history of your project. How do you undo something you've committed to history without rewriting history? The answer is you can actually rewrite history using the git reset command, but it's rather risky and not good practice to do so. A better solution is to work with the historical timeline and simply pull an older version of your code up to the top of the branch. This is done using git revert. For this to work, you need to know the commit ID for the commit you want to revert to. This is a machine-generated pile of random numbers and letters also known as a hash. To get the list of everything that's happened in the repository, including the…

Contents