Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clean not removing sub-directories (not recursive)

Tags:

git

I am facing problems with git clean. Consider the following scenario:

git status -su ?? file_1 ?? xyz/file_2  git clean -f Not removing xyz/file_2 Removing file_1 

I don't want to remove the xyz folder, but I want to remove the file_2 inside it.

Why is git clean is not working recursively?

like image 750
Ankita Avatar asked May 04 '11 07:05

Ankita


People also ask

How do I permanently delete untracked files in git?

Run 'git clean -n' to see a dry run; Run 'git clean -f' to force untracked file deletion; Use 'git clean -f -d' to remove untracked directories; Use 'git clean -f -x' to remove untracked .

Does git clean remove ignored files?

The git clean command also allows removing ignored files and directories.

What does git clean Xfd?

From time to time, git clean -xfd will not only remove untracked files and directories but also remove tracked files. After cleaning I can restore those tracked files with git reset --hard head .


1 Answers

If you have it in ignore, use git clean -xf. You can do git clean -xdf but that will also remove untracked directories. Use -n for a dry-run.

http://gitready.com/beginner/2009/01/16/cleaning-up-untracked-files.html

like image 54
manojlds Avatar answered Sep 26 '22 12:09

manojlds