From the course: Complete Guide to Git
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Soft reset - Git Tutorial
From the course: Complete Guide to Git
Soft reset
- [Person] In this movie, we'll learn how to perform a soft reset. As we already discussed, when you have a soft reset in Git, it will move the branch and the HEAD pointer to a specified commit. It does not make changes to the staging index or to the working directory. What that means is that those will still have the files in the state they were in before you moved the branch and the HEAD pointer, you'll see that clearly in a moment. The command that we use is "git reset" with the "--soft" option, followed by a reference to a commit. That can be a SHA, it can be another reference, but some reference to tell it where we want to reset it to. The effect of a soft reset is it will change the repository state, but leave all the changes in our staging index, as if they're ready to be committed. It's useful when we want to amend one or more commits because the changes are there, waiting for us to commit them. A good example is you might want to just roll back the history, and commit…
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.