Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
We've seen how we can add items to the stash, take a look at them while they are in the stash, and retrieve them from the stash. The last step is to be able to delete items that are in the stash without applying them. Now we made some changes to mission.html, we stash those, and then we used git stash apply, so they actually stayed in the stash while they pull them out. So if we do git stash list, you'll see there is still this change to the mission page title in the stash. What we want to do now is delete the stash set of changes.
The way we do that is pretty simple, we just like everything else say git stash followed by the command that we want to do to the stash, git stash drop, and then you want to provide the reference for what you want to drop. So git stash drop that item stash@, then the curly braces with the 0 in the middle. That will just simply drop that one item, comes up and tells us I dropped it. Git stash list now, and it's gone, it's that easy. Let me also show you another way to delete, let's make another change first.
Let's open up our tours.html file, at the top instead of just tours, we can say our tours. That's a very simple change, very similar to what we did in mission, we do git status, we now see we have changes both of those files. Let's stash those changes, stash save "Changed mission & tours page title," can be absolutely anything you want. Now if we say git stash list, we can see that we have that item saved there, git status shows that our working directory is clean.
All right, let's just make another one. Let's go into explorers, and let's scroll down here in the explorer section and here is the word that's misspelled, enthusiasts. So enthusiasts has an extra S in it, you want to take that S out, let's save the file close it up, git status, we can see that the changes there in our working directory, let's stash it, git stash save "Fixed typo in explorers page." Now if you say git stash list, we can see that we have two items in there.
Now we certainly could work with each one of those too. I'll just show you again. We could work with each of those, we could pop them or apply them, we know how to do that. If we want to drop them, we could drop each of them just by using the reference. What I want to show you now is how we can delete everything that's in the stash all at once. Sometime it happens for me when I'm developing that I take ideas that I had or something that I was working on, and I stash them, and then later, either I apply those changes, or I just end up going in a different direction. Maybe someone else does the work for me, so I don't end up having to do it, things like that.
I then may end up with three or four items in my stash that I don't actually need, so it's very helpful to be able to delete them all just saying git stash clear. Now be careful because it is very destructive get stash clear, boom just like that, clears out your whole stash, but if you want to just get rid of everything and start with a clean slate before you start making some stashes that's a good way to do it, git stash clear. So you now know how to drop a particular stash or how to clear all of the stashes.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97442 Viewers
61 Video lessons · 84668 Viewers
71 Video lessons · 68871 Viewers
56 Video lessons · 101326 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.