Setup and Config
Getting and Creating Projects
Basic Snapshotting
Branching and Merging
Sharing and Updating Projects
Inspection and Comparison
Patching
Debugging
External Systems
Server Admin
Guides
- gitattributes
- Command-line interface conventions
- Everyday Git
- Frequently Asked Questions (FAQ)
- Glossary
- Hooks
- gitignore
- gitmodules
- Revisions
- Submodules
- Tutorial
- Workflows
- All guides...
Administration
Plumbing Commands
-
2.50.0
2025-06-16
- 2.43.1 → 2.49.0 no changes
-
2.43.0
2023-11-20
- 2.40.1 → 2.42.4 no changes
-
2.40.0
2023-03-12
- 2.25.1 → 2.39.5 no changes
-
2.25.0
2020-01-13
- 2.18.1 → 2.24.4 no changes
-
2.18.0
2018-06-21
- 2.7.6 → 2.17.6 no changes
-
2.6.7
2017-05-05
- 2.1.4 → 2.5.6 no changes
-
2.0.5
2014-12-17
概要
git check-attr [--source <tree-ish>] [-a | --all | <attr>…] [--] <pathname>… git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>…]
オプション
- -a, --all
-
指定されたパスに関連付けられたすべての属性を一覧表示します。このオプションを使用すると、unspecified の属性は出力に含まれません。
- --cached
-
作業ツリーを無視し、インデックス内の
.gitattributes
のみを対象とします。 - --stdin
-
コマンドラインではなく、標準入力から1行ずつパス名を読み込みます。
- -z
-
出力フォーマットは機械可読形式に変更されます。さらに
--stdin
が指定された場合、入力パスは改行の代わりに NUL 文字で区切られます。 - --source=<tree-ish>
-
指定された tree-ish に対して属性をチェックします。通常、ソースツリーは関連するコミット、ブランチ、またはタグの名前で指定されます。
- --
-
それ以前のすべての引数を属性として、以降の引数をパス名として解釈します。
もし --stdin
、--all
、または --
が使用されない場合、最初の引数は属性として、それ以降の引数はパス名として扱われます。
OUTPUT
出力は次の形式になります: <path> COLON SP <attribute> COLON SP <info> LF
ただし -z
が有効な場合は、区切り文字として NUL が使用されます: <path> NUL <attribute> NUL <info> NUL
<path> は照会されるファイルのパス、<attribute> は照会される属性、<info> は次のいずれかとなります:
バッファリングは git[1] の GIT_FLUSH
オプションに記載されている通りに行われます。呼び出し側は、入力バッファの過剰な充填や出力バッファの空読みから生じるデッドロックを回避する責任があります。
例
例では、次の .gitattributes ファイルが使用されています:
*.java diff=java -crlf myAttr NoMyAttr.java !myAttr README caveat=unspecified
-
単一属性の一覧表示:
$ git check-attr diff org/example/MyClass.java org/example/MyClass.java: diff: java
-
ファイルの複数属性一覧:
$ git check-attr crlf diff myAttr -- org/example/MyClass.java org/example/MyClass.java: crlf: unset org/example/MyClass.java: diff: java org/example/MyClass.java: myAttr: set
-
ファイルのすべての属性一覧:
$ git check-attr --all -- org/example/MyClass.java org/example/MyClass.java: diff: java org/example/MyClass.java: myAttr: set
-
複数ファイルに対する1つの属性の一覧表示:
$ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java org/example/MyClass.java: myAttr: set org/example/NoMyAttr.java: myAttr: unspecified
-
すべての値が等しく明確であるとは限りません:
$ git check-attr caveat README README: caveat: unspecified
GIT
Part of the git[1] suite