+9 votes
1 view
in Devops and Agile by (26k points)
edited by

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

1 Answer

+9 votes
by (43.8k 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

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


Categories

...