Back

Explore Courses Blog Tutorials Interview Questions
+7 votes
2 views
in DevOps and Agile by (29.3k points)
edited by

How do you delete untracked local files from your current working tree?

1 Answer

+7 votes
by (50.2k points)
edited by

Removal of untracked files from the working tree

$git clean -n

$git clean -f

while working with -f be cautious that may delete files.

for removing directories, 

$ git clean -f -d 

   or

$git clean -fd.

For removing ignored files,

$git clean -f -X 

     or 

$git clean -fX

for removing ignored and non-ignored files, 

run git clean -f -x 

        or 

git clean -fx

here x is case sensitive in commands. 

If clean.requireForce is set to "true" (the default) in your configuration, you need to specify -f otherwise nothing will happen.

For more commands like this please go through the following tutorial that helps you to understand better

Browse Categories

...