I have this directory structure:
.gitignore
text1.txt
public
--static
----uploaded-files
------picture1.jpg
this is the content of .gitignore
.idea
public/static/
UPDATE: using git version 2.11.0.windows.1
when i run git clean -nd
to list what untracked files and directories would be removed it says:
Would remove .gitignore
Would remove public/
Would remove text1.txt
even though git status
doesnt show public/
but shows .gitignore
So when i run git clean -fd
its removes public that i want to keep instead
Can somebody please explain why git removes this ignored directory and files in it? Is it because .gitignore gets cleaned first in process and then public is not being ignored while executing this command? or my .gitignore is wrong?
How can i achieve not losing ignored directories but ofc getting rid of untracked files?
UPDATE: with git version 2.17.1.windows.2 public/ directory is no longer part of would remove