在.gitattributes中将文件夹标记为二进制 [英] mark folder as binary in .gitattributes

查看:83
本文介绍了在.gitattributes中将文件夹标记为二进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在存储库中包含一些文件夹,但是我不希望我的git修改其内容(行尾等)

I have to include some folder to a repository but I don't want my git to modify it's content (line endings etc)

我已经有一些文件在.gitattributes中标记为二进制文件,即图像:

I already have some files that are marked as binary files in .gitattributes i.e. images:

*.png binary

但是此规则指定了文件的某些类别-png文件,但是我想实现类似的功能:

but this rule specifies certain category of files - png files, however I want to achieve something like that:

/folder_which_i_want_to_mark_as_binary binary

推荐答案

要修正行尾,您可以按照以下说明进行操作

In order to fix line endings you can apply following instructions

UNIX系统

git config --global core.autocrlf input

Windows系统

git config --global core.autocrlf true

或者(在.gitattributes中)

Alternatively (in .gitattributes)

如果要将特定文件夹中的所有内容都视为二进制文件,则可以在.gitattributes中添加类似内容

If you want to treat as binary everything in a particular folder, in .gitattributes you could add something like

*.sh text eol=lf
*.bat text eol=crlf
folder/* binary 

注意:folder必须是文件夹的名称.

Note: folder must be the name of your folder.

这篇关于在.gitattributes中将文件夹标记为二进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆