In git-clean documentation, it says:
-x
Don’t use the standard ignore rules (see gitignore[5]), but still use the ignore rules given with -e options from the command line. This allows removing all untracked files, including build products. This can be used (possibly in conjunction with git restore or git reset) to create a pristine working directory to test a clean build.
While the output of git clean -h says:
...
-x remove ignored files, too
...
Aren’t they contradictory? In my understanding, the standard ignore rules is rules from file .gitignre and .git/info/exclude, etc. According to the documentation, ignored files defined in file .gitignore shouldn’t be cleaned by git clean -fdx, but in fact they are.
>Solution :
No, they’re not. When it says, "don’t use the standard ignore rules", it means, "don’t ignore (i.e., don’t prevent the removal of) files that match the standard ignore rules; treat them as any other untracked files."
Normally files that are ignored are preserved with git clean -df, but with -x, these files are not ignored because the standard ignore patterns are not considered, so the files are considered untracked and hence removed.
You are correct about what the standard ignore rules comprise.