LogoDuyệtSr. Data Engineer
HomeAboutPhotosInsightsCV

Footer

Logo

Resources

  • Rust Tiếng Việt
  • /archives
  • /series
  • /tags
  • Status

me@duyet.net

  • About
  • LinkedIn
  • Resume
  • Projects

© 2026 duyet.net | Sr. Data Engineer

Git - Tutorial remove untracked files

Note: This post is over 11 years old. The information may be outdated.

If you have a bunch of untracked files and want to remove them all in one go then just do this:

$ git clean -f

Useful Options

Dry run - See what would be removed without actually deleting:

$ git clean -n

Remove untracked directories - Include directories in cleanup:

$ git clean -fd

Interactive mode - Choose which files to remove:

$ git clean -i

Force with directories - Remove both files and directories:

$ git clean -ffd

Important Notes

  • Untracked files are files that Git hasn't tracked yet (not in .gitignore, not staged, not committed)
  • Warning: git clean is destructive and cannot be undone. Always use -n (dry run) first to verify what will be deleted
  • Use git clean to clean up build artifacts, node_modules, logs, and other temporary files not tracked by Git
Aug 25, 2015·10 years ago
|Git|
Git
|Edit|
On this page
  • Useful Options
  • Important Notes
On this page
  • Useful Options
  • Important Notes