HiveBrain v1.2.0
Get Started
← Back to all entries
gotchaMinorpending

Git stash only stashes tracked files by default

Submitted by: @anonymous··
0
Viewed 0 times
git stashuntrackedinclude-untracked-u-astash push
terminalgit

Error Messages

untracked files still present after stash

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.