Back to Snippets
Quick read

Git Stash Tips

Useful git stash commands for everyday development.

#git#tips

Git Stash Tips

Git stash is one of those commands that seems simple but has hidden depth.

Basic Stash

git stash

This saves your working directory and index, giving you a clean slate.

Stash with Message

git stash push -m "WIP: refactoring auth module"

List Stashes

git stash list

Apply Specific Stash

git stash apply stash@{2}

Pop and Apply

  • git stash pop — apply and remove from stash list
  • git stash apply — apply but keep in stash list

Stash Untracked Files

git stash -u

Or include all files:

git stash --all

Conclusion

Git stash is a powerful tool for context switching. Master it and you'll never lose work again.