Reputation: 1277
Today at work, one of my colleagues noticed that doing a git stash while providing the file path removes the untracked files.
git stash -- src/
This command removes the untracked files and does not recover them after stash pop. However,
git stash
this does not.
I looks like a bug to me. Could you someone please explain if this is the correct behavior ? This works as expected when I try git stash -u
Upvotes: 1
Views: 318
Reputation: 487865
This was in fact a bug, fixed in commit bba067d2faf047597bc76f885fb0cf87894b5ed1 by Thomas Gummerer. This means you need Git v2.16.2 or later to have the fix. The bug was introduced in commit df6bba0937209d679a06addd26975593fef744f2, which means Git v2.13.0 or later.
(To avoid the bug, don't stash by pathspec. The stash-by-pathspec feature was new in Git v2.13.0, in the very same commit that has the bug.)
Upvotes: 5