How to Git Stash Ignored Files?

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).


Hope you found this post useful. It was published . Please show your love and support by sharing this post.