`.gitattributes`文件中`text = auto`的用途是什么? [英] What is the purpose of `text=auto` in `.gitattributes` file?

查看:1275
本文介绍了`.gitattributes`文件中`text = auto`的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

主要是 .gitattributes 文件有 * text = auto 。这个文件中 text = auto 的用途是什么?

Mostly .gitattributes file has * text=auto. What is the purpose of text=auto in that file?

推荐答案

它确保生产线结束正常化。资料来源: Kernel.org

It ensures line endings are normalized. Source: Kernel.org


当文本设置为auto时,路径标记为自动结束标准化。如果git判定内容是文本,那么它的行结束符会在签入时标准化为LF。

When text is set to "auto", the path is marked for automatic end-of-line normalization. If git decides that the content is text, its line endings are normalized to LF on checkin.

如果您想与源代码管理系统进行互操作,或者只是希望将存储库中的所有文本文件进行标准化,则应该将text属性设置为自动,以存储所有文件。

If you want to interoperate with a source code management system that enforces end-of-line normalization, or you simply want all text files in your repository to be normalized, you should instead set the text attribute to "auto" for all files.

这可以确保git认为是文本的所有文件都会在存储库中有标准化(LF)的行尾。

This ensures that all files that git considers to be text will have normalized (LF) line endings in the repository.

这篇关于`.gitattributes`文件中`text = auto`的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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