Explaining Git Stash

stash (plural stashes)

- A collection, sometimes hidden; a reserve.
They had quite a stash of food saved up for emergencies.
- (US, slang, informal, African-American Vernacular) A place where drugs are stored.
The dealers managed to store the dope in the stash just in time to avoid being caught by the police.

stash (third-person singular simple present stashes, present participle stashing, simple past and past participle stashed)

- To hide or store away for later use.
He stashed his liquor in the cabinet under the bar.


  • there are 4 spaces of git,
  • the work happens usually between the three of them:
    working area → index → repository
  • stash is the fourth area
  • there is only 1 command to handle stash
git stash
  • you have to be very explicit within the single command
  • git stash is all yours — the data there will not change unless you really want to
  • it is even more yours than the working area and isolated from the 3 main areas
  • for example, say you want to work on something else
  • …but, you have some work already staged within a branch
  • → you can store all your changes in the stash and they will stay there and wait for you to pick it up


git stash save --include-untracked
  • save the current status by or just
git stash --include-untracked
  • also include files that are not tracked and are entirely new. by default, stash ignores untracked files
  • git takes all the data from working area and stage → add them to the stash
  • aligns the data from working area and stage with the current commit


git stash list
  • the stash is a multiple clibboard where you can store things for later
  • each item gets a serial-id
▶ git stash list
stash@{0}: WIP on newMainMenu: 3179211 publish action executed and links updated


git stash apply
  • without passing the name of the item, it applies it to the most recent one by default

5. POP

git stash pop
  • this deletes the stash when recovering it


git stash clear
  • run git stash clear to clean the entire stash




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pavol Kutaj

Pavol Kutaj


Infrastructure Support Engineer/Technical Writer (snowplow.io) with a passion for Python/writing documentation. More about me: https://pavol.kutaj.com