How to delete all untracked files and folder in git

To delete all untracked files and folders in Git, you can use the following command:

git clean -f -d

This command will delete all untracked files and directories, including files and directories that are ignored by Git.

The -f option stands for “force,” which instructs Git to delete the files without prompting for confirmation. The -d option stands for “directories,” which tells Git to also delete untracked directories.

Be careful when using this command, as it will permanently delete all untracked files and directories without the possibility of recovery. Make sure you have a backup or are sure you want to delete the files before running this command.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *