Discarding All Local Changes in a File

In this episode, we will see how to discard local changes in a file that you haven’t committed yet.

Transcript
Discarding All Local Changes in a File

Hi there and welcome to our series on “Surviving with Git”.

Let’s start with a simple case: undoing local changes in a file that you haven’t committed yet.

So let’s take a closer look. We would like to discard all local changes and have the file exactly as it was when we last committed.

To do this, you can simply right-click the file - select the “discard local changes” option and confirm that. And voila: it’s not amongst the changed files anymore. We successfully undid all local changes in that file.