From the course: Git Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Undo your changes

Undo your changes

- [Instructor] So while we are making changes in our files, we might create changes that we don't want to keep. Maybe we want to go back to the previous commit. We can do that with Git. Let's see how that works. So I'll add some content to this file and let's add some more to this one. There we go. Now, if we look at Git with git status, we see the changed files that have not been added to the staging area yet. So let's do that. I'll use git add and then a .. If I check git status now, they are both added to the staging area. Now, let's say at this point I want to take that back. I don't want to actually move on with this change. And the good thing that we see here is that git status actually tells us what we need to do. It says use git restore --staged, and then the name of a file. So let's try that with the example.md file. So I'll use git restore --staged, and then, example.md. And now, if I look at git status…

Contents