How To Remove New (untracked) Files From A Git Repo

Sometimes whiles working on a project you end up with files and or folders that you don't need.

This usually happens when you run scaffolders or generators. Git allows you to delete such files and folders. They are known as untracked folders or files as they have never been committed with Git and hence not tracked.

👉 Delete untracked files and folders


01: git clean -fd


👉 See which files will be deleted

Before deleting untracked files you can perform a dry run to see which files and folders will be deleted.


01: git clean -fdn

Always perform a dry run before finally deleting, since Git is not tracking changes made to the files and folders, they might be lost forever.

Here is another article for you 😊 "Netlify _redirect not working | fix"