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 - GitHub Tutorial
From the course: GitHub Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Rewriting history with Git2m 18s
-
Oops, I messed up my last commit2m 5s
-
Everything is broken, help me reset history1m 42s
-
Reset back to staging area3m 4s
-
Reset back to the working directory2m 8s
-
Reset to the trash1m 29s
-
I just want that one commit2m 21s
-
I need to restructure my commit history3m 17s
-
Rebase in action2m 37s
-
-
-
-