Git中的多平台开发和autocrlf选项 [英] Multiplatform development and autocrlf option in Git

查看:108
本文介绍了Git中的多平台开发和autocrlf选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用Git,并且在Windows PC上一切正常.我将我的autocrlf设置为true,据此正确

I am currently using Git and all is well on my Windows PC. I have my autocrlf set to true which according to this is correct

https://help.github.com/articles/dealing-with -line-ends

实际上,我没有任何抱怨,它似乎工作得很好,时不时有一些警告,但是我通常会忽略它们.

Actually I have no complaints, it seems to work very well, there are some warning now and again but I normally ignore them.

但是,这实际上是做什么的呢?在执行PULL时是否添加CR/LF,然后在进行推送时将CRLF更改为LF?

But what does this actually do then? Does this add CR/LF when doing a PULL and then change CRLF to LF when doing a push?

那么回购中的总是"中有带有仅" LF而不是CRLF的文件吗?

So "ALWAYS" in the repo there are files with "ONLY" LF and not CRLF?

我将开始在与Mac OS X和Linux相同的存储库中进行开发,现在这让我感到困惑,据GitHub称,对于Windows,将Autocrlf设置为TRUE.

I am about to start development in the same repository with a MAC OS X and Linux, now this is where I get confused, according to GitHub it states that for Windows set Autocrlf to TRUE.

但是在Linux/MAC OS X上,我应该这样做吗?我知道Linux不使用CRLF.

But on Linux / MAC OS X, should I do the same? Linux I know doesn't use the CRLF.

我看到关于Stack Overflow的各种评论都没有将其当作真实使用,但是我当然使用了3种类型的系统,所以我想这就是为什么在这里推荐它的原因?

I see various comments on Stack Overflow to not use it as true, but of course I am using 3 types of systems so I suppose this is why it's recommended here?

也建议使用Linux吗?但这绝对不会成功.

And Linux is recommended too? but it would never make crlf.

所以我想是这样,以防万一?

So I suppose the case is, always leave it as true, just in case?

推荐答案

在OS X上也将autocrlf设置为true.它将做正确的事. (实际上,您也可以在Linux上进行设置,它将再次执行正确的操作.)

Set autocrlf to true on OS X as well. It will do the right thing. (In fact, you can also set it on Linux and it will again do the right thing.)

但是,这实际上是做什么的呢?在执行PULL操作时会添加CR/LF,然后在执行推送操作时将CRLF更改为LF吗?

But what does this actually do then? Does this add CR/LF when doing a PULL and then change CRLF to LF when doing a push?

是的.在本地检出文件后,它将文件转换为本地本地行尾格式,然后在提交后将它们自动转换回规范行尾格式(LF).

Yes. It transforms files into the local native line ending format when they're checked out locally, and then when they're committed they're automatically transformed back into the canonical line ending format (LF).

这篇关于Git中的多平台开发和autocrlf选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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