Stash
When we reviewed the five areas of Git, we included an area called the stash, but we did not delve into what the stash is. In short, the stash is a place where you can hold (stash) files you've modified but not yet committed:
Figure 10.1: The five areas of Git
The stash can be pretty important. Let's say you are working on a feature and suddenly you are asked to work on a very important bug. You are not ready to commit the code you have, but you can't switch branches with uncommitted files in the work area.
To solve this, you could just make a backup of your directory, and then delete the uncommitted files, but that is very slow and error-prone. Instead, you want to stash them away somewhere that you can get them back when you are ready, which of course is the purpose of the stash.
To see this at work, we need a repository with some commits. Let's quickly make a mirror of the RockyHorror2
repo. To do so, we'll start by making...