Android的换行和混帐 [英] Android line breaks and git

查看:313
本文介绍了Android的换行和混帐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将把Android项目进入一个Git仓库,但我对行结尾有点不确定

I'm about to put a android project into a git repository, but I am a little uncertain about the line endings

我的这个项目目前住在Windows上,所以autocrlf设置为true,但是当我做了最初​​的承诺,我得到以下警告:

My this project currently lives on windows, so autocrlf is set to true, but when I did the initial commit i got the following warnings:

警告:LF将被CRLF在/project/file.name取代 该文件将有原来的行结束在你的工作目录。

warning: LF will be replaced by CRLF in /project/file.name The file will have its original line endings in your working directory.

首先,为什么某些文件LF当我在Windows上:-S?这是因为Android是基于Linux的,并期望他们成为LF,而不是CRLF?其次,为什么它要提交它们的CRLF?我认为这autocrlf真应该检出的窗口,但签入的UNIX?

First, how come certain files are LF when i'm on windows :-S? Is this because android is linux based and expect them to be LF rather than CRLF? Secondly, how come it wants to commit them as CRLF? I thought it "autocrlf true" is supposed to checkout as windows, but check-in as UNIX?

在夏日,我希望能够用我的两个Mac,Linux和Windows机器的工作在这个项目上。最新最好的程序,accomblish呢? (我一直只是用autocrlf输入适用于Mac / Linux和在过去的窗口autocrlf true和我没有任何问题,但是这是我的第一个Android项目,我打算把在GIT,似乎不同的行为)

In summery, I want to be able to use both my mac, linux and windows machines to work on this project. Whats the best procedure to accomblish this? (I always just used "autocrlf input" for mac/linux and "autocrlf true" for windows in the past and I haven't had any issues, but this is my first android project I am going to put in GIT, and it seems to behave differently)

推荐答案

只要不与 autocrlf 打扰:<一href="http://stackoverflow.com/questions/2016673/definitive-recommendation-for-git-autocrlf-settings/2016763#2016763">keep它为false 。
另请参见<一个href="http://stackoverflow.com/questions/3206843/how-line-ending-conversions-work-with-git-core-autocrlf-between-different-operat/3209806#3209806">How行结束转换具有不同操作系统的之间混帐core.autocrlf工作。

Simply don't bother with autocrlf: keep it to false.
See also "How line ending conversions work with git core.autocrlf between different operating systems".

如果您使用的编辑器不会改变EOLS,可以用LF EOL风格翻过平台完全正常工作。

If you use editors which doesn't change EOLs, you can work entirely with LF eol style accross platform.

如果您FND一些文件,而您的有无以的实施EOL,使用的 gitattribute EOL 的指令。
请参见<一href="http://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-$c$c/2354278#2354278">Distributing与code 混帐配置。

If you fnd some files for which you have to enforce eol, use a gitattribute eol directive.
See "Distributing git configuration with the code".

这篇关于Android的换行和混帐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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