From the course: Complete Guide to Git

Unlock the full course today

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

Restore changes to previous version

Restore changes to previous version - Git Tutorial

From the course: Complete Guide to Git

Restore changes to previous version

- [Instructor] Git keeps track of our changes over time, so it remembers how files looked in the past. In this chapter, we will learn several techniques to undo changes in Git. Let's begin by looking at how we restore files in our working directory and staging index to the previous version. Let's imagine that we make a change to our project that we didn't mean to make, or just something that we don't want anymore. Maybe it was a careless change on our part, or maybe your cat walked on your keyboard. Let's delete this rotating section of texted images here on the homepage as an example. I'm going to come over here to my project, and on index.html, I can use my text editor. It has a feature that lets me fold up some of these tags. I can expand them back later, but it allows me to kind of get some of these things out of my way until I find the section ID, hero. I'll fold that one up as well. That is that whole section at the top that I'm talking about deleting. So let's say that I had it…

Contents