Git stash untracked files -How do you stash an untracked file?
I have changes to a file, plus a new file, and would like to use git stash to put them away while I switch to another task. But git stash by itself stashes only the changes to the existing file; the new file remains in my working tree, cluttering up my future work. How do I stash this untracked file?
To solve stash untracked files, there is an update in git so for
New versions of git now have
git stash --all
which stashes all files, including untracked and ignored files.
git stash --include-untracked
no longer touches ignored files.
As of version 1.7.7, you can use
git stash --include-untracked
or
git stash save -u
to stash untracked files without staging them.