Remove untracked files in git repo

Snippet

Sometimes, you just want to clean up a git repo, getting rid of the untracked files. "git reset" will reset the repo, but not the untracked files. Use "git clean"

# remove untracked files and directories
$ git clean -f -d 
 
# do a test run first
$ git clean --dry-run -f -d
 
# clean ignored files (emacs turds!)
$ git clean -f -X 

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.