DEV Community

slns
slns

Posted on • Updated on

cheat sheet, Git Stash

Git Stash

Short introduction:

Git stash allows you to save changes without interfering with commits.

For the list of all stashs:
  git stash list
Enter fullscreen mode Exit fullscreen mode
To create a stash(no reference):
  git stash
Enter fullscreen mode Exit fullscreen mode
To retrieve and delete the last stash:
  git stash pop
Enter fullscreen mode Exit fullscreen mode
To retrieve and keep the last stash:
  git stash apply
Enter fullscreen mode Exit fullscreen mode
To create a stash with identification:
  git stash save nome_do_stash
or
  git stash save 'nome do stash'
Enter fullscreen mode Exit fullscreen mode
To retrieve and maintain a specific stash:
  git stash apply stash@{n}
or
  git stash apply n
Enter fullscreen mode Exit fullscreen mode
To retrieve and delete a specific stash:
  git stash pop stash@{n}
Enter fullscreen mode Exit fullscreen mode
To delete a specific stash
   git stash drop stash@{n}
or
   git stash drop n
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
dnature profile image
Divine Hycenth
   git stash drop stash@{n}
or
   git stash drop n
Enter fullscreen mode Exit fullscreen mode

To delete a specific stash