Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In last movie, we saw how to make an edit and then to put it into the stash. In this movie, we're going to see how we can view those changes in the stash. Once again, we're going to use the git stash command, that's going to be true for all of the things that have to do with the stash, git stash followed by something else. Before we did git stash save, this time we're going to do git stash list, and that's going to show us a list of the things that are in the stash. So here, there's one item in the stash, it's this line right here, stash @ sign, curly braces, 0.
This is the way to refer to this item in the stash. Let's remember that, that's the syntax, stash @ sign, curly braces followed by a number. The number here is going to be 0, next one will be 1, then 2, then 3, then 4 and so on, so there're all going to be numbered. Next it tells us on shorten_title, that's the branch that I was on, when I put it in the stash because the stash is going to be accessible even when I switch branches. So if I switch to my master branch, let's try that real quick, git checkout master, and then I do git stash list.
It's still there. The stash is available all the time. I can always pull from it. That makes it really handy, especially if you start to make a change on one branch, and then you realize this isn't the branch that you wanted to commit those changes to, you can put them in the stash, change your branches and then pull them back out of the stash again. Back to the listing, it tells us what branch we were on, when we first made the stash, and then it gives the description that we gave to it, so we'd know what where we stashing. Now we can see more information about each of those stashes by saying, git stash show, and then this name right here.
Now it's a bit awkward to type the name, I know it is. It's stash, @ sign, curly braces, zero, curly braces. That's how we refer to it. And it comes up and by default it shows us what's called diff stat. This is a stat about what changed in this file. So that's by default. If we want to see more information, we really want to use the -p option, which is show it to us as a patch. A patch is a section of code that you can apply to different things to modify them and change them. So this is basically saying, show us the edits.
The -p option, I'm going to clear the screen before I do it, and what we see is the typical diff that we're used to showing us the sets of changes. This is very similar to showing a commit. So now that we know how to put things into the stash, we know how to look at the stash and see what's in there. Next thing is to be able to pull items out of the stash, and we'll do that in the next movie.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97068 Viewers
61 Video lessons · 84386 Viewers
71 Video lessons · 68602 Viewers
56 Video lessons · 101085 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.