From the course: Visual Studio: Source Control with Git and GitHub

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

When to use revert or reset

When to use revert or reset - Visual Studio Tutorial

From the course: Visual Studio: Source Control with Git and GitHub

Start my 1-month free trial

When to use revert or reset

- [Instructor] We have a problem in this repository. Terry has checked in some code into the shared repo and she's made a mistake. So we would like to roll back. And when you want to roll back changes, there are other options besides the Visual Studio undo action that I showed you earlier. To get to these actions in Visual Studio, go to History, and then right click on one of the commits. There's two choices, Revert, and Reset with two options, Reset, Keep Changes and Reset, Delete Changes. Now, what's the difference between the two? You use revert to undo the changes made in your commits that have been pushed to the shared branches. Now, that's the problem that we have. Terry has pushed this to the remote repo. So what the revert command does is it creates a new commit that undoes the changes on the previous commit. No history is rewritten and revert making it safe to use when working with others. So let's…

Contents