.gitattributes中没有扩展名的文件

时间:2017-06-28 14:49:03

标签: git gitattributes

我正在尝试在.gitattributes中解决没有扩展名的文件:

* text=auto
*. eol=lf
.py eol=lf

*.显然无济于事。 git check-attr --all -- ./foo输出:

  

./ foo:text:auto

如何做到这一点?

1 个答案:

答案 0 :(得分:3)

我认为您必须为所有文件设置所需的值,然后删除扩展名为的文件的属性:

* text=auto eol=lf
*.* -eol # or set another default value
*.py eol=lf

它会给出结果:

$ git check-attr --all -- file
file: text: auto
file: eol: crlf
$ git check-attr --all -- foo.py
foo.py: text: auto
foo.py: eol: lf
$ git check-attr --all -- bar.txt
bar.txt: text: auto
bar.txt: eol: unset