How to Remove Local Untracked Files with Git

There are times when you do git pull or git pull rebase you get a lots of files that other people contributed that leaves you with lots of untracked files or may be other situation, first thing to try is:

git rest --hard head

If the above does nto help then you can do this

git clean -fd

The above will remove directories as well. Here are some other options that may help.

1) To remove ignored files run:

git clean -f -X or git clean -fX

2) To remove ignored and non-ignored files.

run git clean -f -x or git clean -fx

Git web site has all other option on git-clean.