How to remove untracked files using git?
git clean removes all the untracked files from the project.
It is very in large projects where you have lots of build related, log files which are not necessary to build the product. If you want to take the project to the clean state,
- Either you have to delete all those untracked files manually
- Clone the repository again.
Both of them are time consuming. That is where
git clean comes in handy.
For example, running the following command takes the project to the fresh cloned repository state.
git clean -f -x -d