Git ~ Clean - rohit120582sharma/Documentation GitHub Wiki

The git clean is a convenience method for deleting untracked files in a repo's working directory. Untracked files are those that are in the repo's directory but have not yet been added to the repo's index with git add.

The git clean will clear your working area by deleting untracked files. This operation can not be undone.

Use the --dry-run flag to see what files would be deleted. The -d flag to see what directories would be deleted. The -f flag to do the deletion.

$ git clean --dry-run
# would remove a-note.txt

$ git clean -d --dry-run
# would remove a-note.txt
# would remove scratch/

$ git clean -d -f
# removing a-note.txt
# removing scratch/

⚠️ **GitHub.com Fallback** ⚠️