Forrest logo
back to the git tool

git-clean:tldr:cc20f

git-clean: Forcefully delete directories that are not tracked by Git.
$ git clean -fd
try on your machine

The command "git clean -fd" is used to remove untracked files and directories from a Git repository.

Here's what each option means:

  • "git clean" is the primary command for removing untracked files and directories.
  • "-f" stands for "force" and tells Git to carry out the clean operation without any confirmation prompts. It overrides Git's default behavior of asking for confirmation before deleting untracked files or directories.
  • "-d" stands for "directories" and tells Git to also remove untracked directories in addition to files. By default, Git only removes untracked files and leaves directories intact.

So, when you run "git clean -fd", it will remove all untracked files and directories in the repository without asking for confirmation. This can be useful when you want to clean up your repository and remove any files or directories that are not being tracked by Git.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool