Linux command
git-check-attr 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Check attribute for file
git check-attr [attribute] [file]
Check all attributes
git check-attr -a [file]
Check for multiple files
git check-attr [attribute] [file1] [file2]
Check from stdin
echo "[file]" | git check-attr --stdin [attribute]
说明
git check-attr displays gitattributes information for specified paths, revealing how Git will handle files according to .gitattributes configuration. This debugging tool shows the effective attribute values after all gitattributes rules are applied. Gitattributes control various behaviors including line ending conversion (text/eol), diff drivers, merge strategies, export handling, and language detection. The command resolves attribute values from .gitattributes files in the working tree, index, and repository. Output shows each path with its attribute values, using "set", "unset", or "unspecified" status. This helps debug unexpected Git behavior related to file handling, such as incorrect line ending conversions or merge conflicts in generated files.
参数
- -a, --all
- Check all attributes.
- --stdin
- Read pathnames from stdin.
- -z
- NUL-terminated output.
FAQ
What is the git-check-attr command used for?
git check-attr displays gitattributes information for specified paths, revealing how Git will handle files according to .gitattributes configuration. This debugging tool shows the effective attribute values after all gitattributes rules are applied. Gitattributes control various behaviors including line ending conversion (text/eol), diff drivers, merge strategies, export handling, and language detection. The command resolves attribute values from .gitattributes files in the working tree, index, and repository. Output shows each path with its attribute values, using "set", "unset", or "unspecified" status. This helps debug unexpected Git behavior related to file handling, such as incorrect line ending conversions or merge conflicts in generated files.
How do I run a basic git-check-attr example?
Run `git check-attr [attribute] [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a, --all do in git-check-attr?
Check all attributes.