How to preserve all ignored files in git clean -fd?
What I want is to delete all unrevisioned files in a git repo while excluding all ignored files (i.e. DON’T delete gitignored files). What could I do?
One Solution collect form web for “How to preserve all ignored files in git clean -fd?”
Git normally don’t clean ignored files unless you specify the
-x flag, but strangely it cleans out when configured as you did (
As @VonC commented it out, you should change your
.gitignore to ignore the directory (
data/) rather than what’s in it (
It’s a subtle difference, but it matters to git.