I have a file .vscode/settings.json that's listed under .gitignore. Thus git stash will skip stashing it. This causes the following error when I check out another branch
error: Your local changes to the following files would be overwritten by checkout:
.vscode/settings.json
This happens even if I issue git stash --all. Even if I temporarily comment out the file path in .gitignore, this seems to not work since stashing will also stash the change to .gitigore, thereby nullifying the commenting out.
Why isn't git stash --all ignoring the .gitignore file? What's the best way to stash a gitignored file?