Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 1013 Bytes

GIT_STASH.md

File metadata and controls

55 lines (35 loc) · 1013 Bytes

Stashing

There are times when you want to work on a project but you've made changes which are not ready to be committed, there's a powerful tool to help us with that: git stash.

Basically this command saves modified files and puts them in a stack where they can be later accessed if needed.

To stash modified files and staged changes:

$ git stash

This will clean your working directory, you can confirm that by using:

$ git status

To see a list of stored stashes use:

$ git stash list

Then if you want to apply the most recent stash run:

$ git stash apply

You can also call to a specific stash by using:

$ git stash apply stash@{1}

You can also delete a stash from your stash list by using:

$ git stash drop stash@{0}

To stash and drop current changes use:

$ git stash pop

It's also possible to create a branch from a stash by using:

$ git stash branch {NameOfBranch}