I'm having an issue where when I run git stash -u
(ie. stash all, including untracked files), Git removes my node_modules directory. On top of this, it doesn't even restore it on git stash pop
- I have to run npm install
again to get it back.
node_modules is ignored in .gitignore (via the line node_modules/*
), and as far as I can see has never been committed in the history of the project (git log --all -- node_modules
returns nothing). Shouldn't git stash
ignore it (even when committing untracked files)? I'm pretty sure I've used git stash
like this before without any issues with node_modules.
Update: I've checked, and this issue is not limited to a particular project - it seems to happen anywhere I run git stash -u
. For what it's worth, my Git version is 2.6.3.windows.1 (on Windows).
You have to change your .gitignore
entry from:
node_modules/*
to
node_modules/
More details here: Git Stash Can Delete Ignored Files (git stash -u)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With