From the course: GitHub Essential Training

Unlock the full course today

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

Reset back to the working directory

Reset back to the working directory - GitHub Tutorial

From the course: GitHub Essential Training

Start my 1-month free trial

Reset back to the working directory

- [Instructor] Now that we've seen what Git reset --soft does, let's go ahead and do our second reset of Git reset --mixed or just Git reset. So looking at our commit history, let's reset our most recent commit as well as our commit number four. So we'll be resetting all the way back to our file three. Now we can do that by typing Git reset. And at this point, I could just copy the commit ID associated with file three just like we did on our previous reset. But there's another way that I can tell Git to reset. I can tell Git to move head down certain commits. As head is now pointing to our most recent commit, I can tell Git reset to move head down two spots which will now be pointing to our file three. So I can type head ~2, which is going to move head down two commits. Now if I go ahead and run this command, I can now type Git lol and I see that we have now reset head back to our file three. Now we ran Git reset --mixed or again just this Git reset, so I should expect to see these…

Contents