gotchaMinorpending
Git stash only stashes tracked files by default
Viewed 0 times
git stashuntrackedinclude-untracked-u-astash push
terminalgit
Error Messages
Problem
After git stash, new untracked files are still in the working directory. git stash pop brings back tracked changes but the untracked files were never stashed.
Solution
Include untracked files: git stash -u (or --include-untracked). Include ignored files too: git stash -a (or --all). To stash specific files: git stash push -m 'message' file1.txt file2.txt. View stash contents: git stash show -p stash@{0}.
Why
git stash was designed to stash tracked modifications only. Untracked files are considered not yet part of the repository and are left untouched by default.
Revisions (0)
No revisions yet.