我特别需要git将大多数文件扩展名视为二进制文件,除了少数扩展名。我想将所有文件扩展名视为二进制、.pdf、.doc、.xls等,纯文本文件除外,如.txt、.rb、.py等。我试过像下面这样配置.gitattributes看看它是如何工作的:#cat.gitattributes*binary*.txttext我认为配置文件中的顺序可能很重要,但似乎并不重要。使用上述配置,所有文件仍被视为二进制文件。有没有办法配置.gitattributes或git任何其他方式来以一种方式将所有文件视为二进制文件,除了少数异常(exception)?更新1:我尝试了下面描述的.gitattribute
最近我在.gitattributes文件中发现了以下条目:"*text=auto!eol"!eol是做什么的? 最佳答案 Git有两个处理行尾的属性:正文文档说:Thisattributeenablesandcontrolsend-of-linenormalization.Whenatextfileisnormalized,itslineendingsareconvertedtoLFintherepository这实际上意味着当您提交repo协议(protocol)时,它会将行尾转换为LFeol文档说:Thisattributese
我收集到(尽管缺少文档)away设置Gitattributes全局;但我不清楚在哪里放置必要的gitattributes文件。instructions说他们属于$(prefix)/etc/gitattributes但是$(prefix)在哪里?特别是,对于OSX(在/usr/local/git/bin/git中有Git),它会在哪里?或者(或另外)将~/.gitattributeswork? 最佳答案 全局设置与系统范围设置您问题的术语有些含糊不清。在Git上下文中,“全局”通常意味着“用户级别”;换句话说,全局设置会影响一个特定用
大多数.gitattributes文件都有*text=auto。该文件中text=auto的用途是什么? 最佳答案 来自thedocs:Eachlinein.gitattributes(or.git/info/attributes)fileisofform:patternattr1attr2...所以这里的pattern是*,表示所有文件,属性是text=auto。text=auto有什么作用?来自文档:Whentextissetto"auto",thepathismarkedforautomaticend-of-linenorma