From the course: Complete Guide to Git

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Revert commits

Revert commits

- [Instructor] In this movie, we will learn how to revert commits. Revert means to return something to a previous state. Essentially, we are reversing or undoing a commit that's already been made to the repository. We want our source code manager to keep track of all changes to a project, and that includes undoing changes we made in the past. We don't want it to forget that a change existed for some period of time before it was later reverted to the previous state. We want the log to be a complete history of the project over time. You could undo the changes that you made before by hand, and then make a new commit. That's a perfectly valid way to do it. But Git makes it easy to perform an exact reversal. You can use the revert command and then identify the commit we want to revert. When we do that, Git will add a new commit to the repository, which reverses the commit that we specified. To do that, Git takes the previous change set and just simply reverses it. Everything we previously…

Contents