git clean directories in untracked files

How can I remove directories from untracked files that aren’t appearing in git clean -n? Here are my steps:

git status

…gives me:

Untracked files:
(use "git add <file>..." to include in what will be committed)

css/
../../../../../../../../site-testing/lru-cache/

I get no results from git clean -n (or git clean --dry-run).

How can I remove these directories from appearing in untracked files?

  • git status show files between “”
  • files in the git repo are both deleted and untracked but they're still there. How is that possible?
  • “fatal: Not a git repository (or any of the parent directories)” from git status
  • git status says up-to-date with remote even though it's not
  • Why does “git status” show way too much untracked files?
  • Making `git status` ignore whitespace changes
  • How to colorize git-status output?
  • How to make git status show only staged files
  • 4 Solutions collect form web for “git clean directories in untracked files”

    You need to add them to a .gitignore file

    http://git-scm.com/docs/gitignore

    if you want to delete all the files, which are not controlled by git, use

    git clean -d -f -x
    

    if you want to ignore them — use .gitignore file as @tom.alexander suggests.

    Use:

    git clean -xdf
    

    It restores your directory (and sub-directories) to pristine condition.

    By default, git clean operates recursively from the current working directory. Try moving to a parent directory of your working copy and invoking it from there:

    cd ../../../../../../../../
    git clean -n
    
    Git Baby is a git and github fan, let's start git clone.