Decade Moon
Decade Moon

Reputation: 34306

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.)

Upvotes: 2

Views: 128

Answers (1)

Decade Moon
Decade Moon

Reputation: 34306

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

Upvotes: 1

Related Questions