Last updated 2022-07-01 13:29:55

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 ad tracked by Git and hence not tracked.

Delete untracked files and folders

$ 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:

$ 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 you might like 😊 "How To Remove The Arrow From The HTML Details Tag"