can't delete ".git" using git clean -xdff

327 Views Asked by At

git clean with the -ffxd option does not clean directories called .git - how can I do this?

Using git 2.32.0

mkdir myrepo && cd myrepo
git init .
mkdir src && cd src
touch code.cpp
git add code.cpp
git commit -m "my commit"
mkdir .git .git2
git clean -ffxdn
Would remove .git2/

but I want git clean to remove .git as well. but it is ignored.

from man git-clean:

       -f, --force
           If the Git configuration variable clean.requireForce is not
           set to false, git clean will refuse to delete files or
           directories unless given -f or -i. Git will refuse to
           modify untracked nested git repositories (directories with
           a .git subdirectory) unless a second -f is given.

so what am I doing wrong?

0

There are 0 best solutions below