Git Remove Untracked Files using Command

In order to remove untracked files in Git make use of the git clean command with -i option for interactive mode.

% git clean -i -f

Would remove the following item:
*** Commands ***
    1: clean          
    2: filter by pattern
    3: select by numbers
    4: ask each
    5: quit
    6: help
What now> 1
Removing .temp
Removing index.html
Git Remove Untracked Files using Command
Some Options:
-i (--interactive) --> Interactive Mode
-f (--force) --> Force
-d --> Include directories
-n (--dry-run) --> dry run
-q (--quiet) only report if errors

Read More:


Have Questions? Post them here!

Topics Coverage:

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.

Follow Us: GitHub | Facebook | Twitter | Instagram