Explore Courses Blog Tutorials Interview Questions
+7 votes
1 view
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 


$git clean -fd.

For removing ignored files,

$git clean -f -X 


$git clean -fX

for removing ignored and non-ignored files, 

run git clean -f -x 


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

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories