Undo a Commit
Let’s learn how to undo or reset a commit from our local repository in this lesson.
We'll cover the following
While working on any project, it is common for us to make mistakes. For example, we might accidentally delete files, misunderstood the requirements and code up something else. Or just got stuck in some bug, and now we do not have a working copy of our code.
There are several ways to fix these problems. We can simply nuke the local repository and create a new clone. However, this approach will only work if we have a remote repository to fall back on.
Another option would be to undo all the changes that we have made. But, if our changes are present in multiple files, this process can be time-consuming. There is an easier alternative.
Get hands-on with 1400+ tech skills courses.