gitgit-clean

Git clean removed files not shown in git status


First I ran git status

[user@dev config]$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       app1-core/
#       app1/local.json.hold
nothing added to commit but untracked files present (use "git add" to track)

later on I ran git clean.

[user@dev config]$ git clean -xfd
Removing app2/local.json
Removing app3/local.json
Removing app4/local.json
Removing app5/local.json
Removing app6/local.json
Removing app1-core/
Removing app1/local.json.hold

I'm wondering why it removed these additional files that didn't show up as untracked in the git status command above.


Solution

  • Because -x means: "don’t use the standard ignore rules read from .gitignore"