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).
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.