'Why did `git clean` delete more files than it should have?

Here's the output from some git commands I recently executed:

$ git status
On branch develop
Your branch is up to date with 'origin/develop'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    ../../.yarn/releases/yarn-3.1.1.cjs

$ git clean -fd ../..
Removing ../../.yarn/releases/yarn-3.1.1.cjs
Removing ../lame/lame-3.100/ACM/
Removing ../lame/lame-3.100/Dll/
Removing ../lame/lame-3.100/debian/
...more lines...

According to git status, the only untracked file is yarn-3.1.1.cjs; so why did git clean delete some extra lame files too?

(I didn't lose anything important, just curious why git behaved this way.)

git


Solution 1:[1]

I think what happened was all the lame stuff git clean deleted was just empty directories. git status does not list empty untracked directories.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Decade Moon