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?
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 .
The git clean command also allows removing ignored files and directories.
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 .
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With