首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

git check-attr

命名

git-check-attr - 显示 gitattributes 信息

概要

代码语言:javascript
复制
git check-attr [-a | --all | attr…?] [--] pathname…?
git check-attr --stdin [-z] [-a | --all | attr…?]

描述

对于每一个路径,如果每个属性是此命令将列出unspecifiedsetunset作为 gitattribute 在那个路径名上。

选项

-a, --all

列出与指定路径关联的所有属性。如果使用此选项,则unspecified属性将不会包含在输出中。

--cached

只考虑.gitattributes索引,忽略工作树。

--stdin

从标准输入中读取路径名,每行一个,而不是命令行。

-z

输出格式被修改为机器可解析的。如果--stdin还给出,输入路径用 NUL 字符而不是换行字符分隔。

--

将所有前面的参数解释为属性,将所有后面的参数解释为路径名称。

如果没有--stdin--all或者--被使用时,第一个参数将被视为一个属性和的参数作为路径名的其余部分。

输出

输出格式为:<path>(<路径>)COLON SP <attribute>(<属性>)COLON SP <info>(<信息>)LF

除非-z有效,在这种情况下,NUL 用作分隔符:<path> NUL <attribute> NUL <info> NUL

<path>是被查询文件的路径,<attribute>是被查询的属性,<info>可以是:

不明

当该属性未被定义为路径时。

未设置

当该属性被定义为false时。

设置

当该属性被定义为 true 时。

<value>

当一个值已经被赋值给该属性时。

缓冲发生GIT_FLUSH在 git [1] 中的选项下。调用者负责避免溢出输入缓冲区或从空输出缓冲区读取引起的死锁。

示例

在示例中,使用以下.gitattributes文件:

代码语言:javascript
复制
*.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
  • 列出文件的多个属性:
代码语言:javascript
复制
$ 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
  • 列出多个文件的属性:
代码语言:javascript
复制
$ git check-attr myAttr -- org/example/MyClass.java org/example/NoMyAttr.java
org/example/MyClass.java: myAttr: set
org/example/NoMyAttr.java: myAttr: unspecified
  • 并非所有的价值观都同样明确:
代码语言:javascript
复制
$ git check-attr caveat README
README: caveat: unspecified

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com