Forrest logo
back to the git tool

git-check-ignore:tldr:050b8

git-check-ignore: Include details about the matching pattern for each path.
$ git check-ignore --verbose ${filenames_or_directories}
try on your machine

The git check-ignore --verbose command is used to determine if files or directories are being ignored by Git.

Here's how each part of the command works:

  • git: Refers to the Git command-line tool.
  • check-ignore: The specific command used to check if files or directories are ignored.
  • --verbose: This option enables the display of additional information, providing more details about ignored files or directories.
  • ${filenames_or_directories}: This part of the command should be replaced with the specific files or directories that you want to check for being ignored. You can specify multiple filenames or directories separated by spaces.

When you run this command, Git will analyze each specified file or directory and determine if it is ignored based on the rules defined in your Git repository's configuration (such as .gitignore files). The --verbose option will provide additional information, including the specific patterns that caused the files or directories to be ignored.

For example, running git check-ignore --verbose file.txt would check if file.txt is being ignored and display additional details like the specific pattern in an ignore file that caused it to be ignored.

Note: The ${filenames_or_directories} should be replaced with the actual names of files or directories that you want to check.

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