Skip to main content

Command Palette

Search for a command to run...

How to use git stash ?

Updated
1 min read
How to use git stash ?
S

I love learning about technology and sharing that with others

How to use git stash

Here's the sequence to follow when using git stash:

  1. Save changes to branch A.
  2. Run git stash.
  3. Check out branch B.
  4. Fix the bug in branch B.
  5. Commit and (optionally) push to remote.
  6. Check out branch A
  7. Run git stash pop to get your stashed changes back.
Listing stashes
  • git stash list --> to see all the stashes
Use any stashed changes

git stash pop stash@{1}

description to git stash
  • git stash save "some kind of description"
Created new branch from a stash

git stash branch test_2 stash@{0}

More from this blog

H

hashcodehub

271 posts

Consistent, Passionate and Organized :)