Untracked files are any files in your working directory that were not in your last snapshot(version) and are not in your staging area(state before commit ).
When you create a new file in your repository, then the file will be listed as
To remove Un-Tracked files you need to use
git clean, it Cleans the working tree by recursively removing files that are not under version control, starting from the current directory.
To only the un-tracked files which will be deleted, you need to use
n option with the
git clean command.
git clean -n
-n is short form for
ioptions used to set interactive mode , you will get a quick overview of what is going to be deleted offering you the possibility to include/exclude the affected files.
git clean -i
To delete un-tracked files , you
git clean -f
Use -f option tp remove un-tracked directory
git clean -f -d
You can combine both
git clean -fd
If clean.requireForce is set to "true" (the default) in your configuration, one needs to specify -f otherwise nothing will actually happen.
You will get Message like
clean.requireForce defaults to true and neither -i, -n, nor -f given; refusing to clean
-X option is used to remove Ignored files in git
git clean -f -X
A gitignore file specifies intentionally untracked files that Git should ignore.
-x option is used to remove Ignored files in git
git clean -f -x
git clean Removes un-tracked Files
-nlist untracked files
-ilist untracked files in interactive mode
-fRemove untracked files
-fdRemove untracked directories
-fXRemove only ignored files
-fxRemove ignored and other files(un-tracked files )
Please donate here, for making more tutorials.