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.

Example:
% git clean -i -f


Would remove the following item:
  HelloWorld.java
  .temp
  index.html
*** Commands ***
    1: clean          
    2: filter by pattern
    3: select by numbers
    4: ask each
    5: quit
    6: help
What now> 1
Removing HelloWorld.java
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: https://git-scm.com/docs/git-clean#Documentation/git-clean.txt---force

-




Have Questions? Post them here!