From the course: Coding Exercises: Git

Unlock the full course today

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

Creating a safety net for fixes

Creating a safety net for fixes - Git Tutorial

From the course: Coding Exercises: Git

Creating a safety net for fixes

(beeping) (upbeat music) - [Instructor] Let's say that you valiantly did a git reset with the hard flag and then panic strikes. You realize that you didn't mean to do that. Is there a way to undo a hard reset? I'll give you a couple of seconds to think about how you would do something like this. (beeping) (upbeat music) Now have no fear, advanced users of git know that there is another way to get out of a hard reset. So let's take a look at our git log. We'll do a git log one line here. And you'll see that my log shows a number of different commits, and let's just find a commit that is way farther back and we'll do a hard reset here. So let's clear this out, and we'll do a git reset, and the hard flag will let us rewind to this particular commit. So now we're back somewhere in our history, and if I do another git log, one line here, you'll see that my earlier history is now gone. So I used to think that there is…

Contents