To stash ignored files, you need to first add them to the set of tracked files, for example, by using the --force (or -f shorthand) flag with git add like so:
git add --force path/to/ignored-file git add -f path/to/ignored-file
Then to stash them you can simply use the git stash command right after, like so:
git stash
You may, alternatively, also stash all files (including tracked, untracked and ignored files).