Frequent questions about stash: what it excludes, how to recover dropped stashes, and when to use worktrees instead.
- What does stash exclude?
Untracked files by default. Use
-uto include them,-afor ignored files too.- Can I recover a dropped stash?
Yes, with
git fsck --no-reflog | awk '/dangling commit/ {print $3}'thengit stash apply <hash>, but only if gc has not run.- Stash vs commit?
Stash is temporary and local; commit is permanent and shareable. Use stash for context switches, commit for history.
- Stash vs worktree?
Stash shelves changes; worktree gives a second working directory. Use worktrees for hours-long parallel work, stash for minutes-long switches.