Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Staged a file, but decided you don't want to commit it? We'll show you how to unstage it.
Make sure that you're in the repository directory, medals
, by typing the command cd medals
.
- Let's suppose we've added a
<h1>Sale: 100% off!</h1>
element inmedals.html
. - We can stage our changes:
git add medals.html
- Now suppose we get word that the store manager doesn't want to do the 100% off sale anymore. But what can we do? We've already staged the code to announce the sale!
- If we run
git status
, we'll see a help message in the output: "usegit reset HEAD <file>...
to unstage" - So, let's try that:
git reset HEAD medals.html
- If we run
git status
again, themedals.html
file will be back in the "Changes not staged for commit" section.
Now, here's the important thing. You don't have to remember this git reset HEAD
command if you don't want to. If you ever have staged changes that you want to unstage, just remember to run git status
, and it will show you the command you need to run.
If you'd like to know more about the git reset
command, check out this link: Git Reset: Atlassian Git Tutorial
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up