windows | 换行符 | windows换行符号和Unix换行符
2021-06-09 02:02
标签:tac hits 本质 cto file img osi 经历 files Windows和Unix(MACOS,Linux)是完全不一样的操作系统 macOS,Linux都是类Unix系统,所以他们存在Unix的配置习惯; 而 windows系统准确是DOS系统 是全新的系统,Windows和Unix有着本质差别 最近,使用git推送项目,遇到之前常见的问题,虽然不是很严重,但是确是影响视觉体验。 问题如下: The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xxxxx. 说的就是 “ 这个文件有它自己原始的行结束在工作区时,警告: LF被CRLF替换 在xxx文件” 说道这,就需要了解 Unxi系统和Windows系统一些微妙的差距 在电脑系统中,如果文件中的内容需要换行,一般是 然而在Windows系统上,出奇的多了一个 1、符号 换行符(LR): line feed简称 回车符(CR): carriage return的简称 换行和回车符实际在文件中的直观感受是这样: 是的 在windows系统中,换行用 在Unix系统中,换行用 2、自动转换 core.autolf是什么? Formatting and whitespace issues are some of the more frustrating and subtle problems that many developers encounter when collaborating, especially cross-platform. It’s very easy for patches or other collaborated work to introduce subtle whitespace changes because editors silently introduce them, and if your files ever touch a Windows system, their line endings might be replaced. Git has a few configuration options to help with these issues. 翻译: 格式和空格经常是开发者在合作交流中遇到的烦人和容易忽视的问题,特别是在跨平台合作中,很容易采用微妙的空格对于补丁或者其他的合作的作品。因为编辑器会稍微采取这些措施,如果你曾经在windows平台创建文件,这些文件的行可能会被替换,Git有一些配置选项去帮助解决这些问题。 所以 设置为 If you’re programming on Windows and working with people who are not (or vice-versa), you’ll probably run into line-ending issues at some point. This is because Windows uses both a carriage-return character and a line feed character for newlines in its files, whereas Mac and Linux systems use only the line feed character. This is a subtle but incredibly annoying fact of cross-platform work; many editors on Windows silently replace existing LF-style line endings with CRLF, or insert both line-ending characters when the user hits the enter key. Git can handle this by auto-converting CRLF line endings into LF when you add a file to the index, and vice versa when it checks out code onto your filesystem. You can turn on this functionality with the core.autocrlf setting. If you’re on a Windows machine, set it to true – this converts LF endings into CRLF when you check out code: 这里需要认清两个区域 如果是进行git操作,其实是涉及了Unix系统配置,Linux也是类Unix系统 所以此时从Windows系统(工作区) ? Unix系统(暂存区(index)或者版本库(repository))会经历 如果涉及从 git(此时指的是Unix系统配置) ? windows本地文件系统(此时指的是windows配置) 会经历 这是由编辑器决定的 如果设置为 则会git会根据你的git操作(git add, git commit等),转换 符号 如果设置为 则不自动转换 如果是windows系统,在windows文件系统中是 If you’re a Windows programmer doing a Windows-only project, then you can turn off this functionality, recording the carriage returns in the repository by setting the config value to false: 详情: https://stackoverflow.com/a/5834094/12341467 所以针对最初的问题: 就是说原本在windows文件系统区域的文件存在Unix配置 然后git add,git commit就会转换(替换)为 即 相关文章: windows | 换行符 | windows换行符号和Unix换行符 标签:tac hits 本质 cto file img osi 经历 files 原文地址:https://www.cnblogs.com/martin-1/p/14862818.htmlwindows换行符号和Unix换行符
前言
\n
,这点在Unix系统是体现的\r
认识概念
CRLE
, 回车+换行符LF
,即换行符
core,autolf
就是说,git
会帮助自动的将CRLF
转化为LF
true
就是转换$ git config --global core.autocrlf true
$ git config --global core.autocrlf true
CRLF
? LF
的转变LF
? CRLF
的转变$ git config --global core.autocrlf true
$ git config --global core.autocrlf false
CRLF
,提交到版本库,也是CRLF
$ git config --global core.autocrlf false
LF
CRLF
The file will have its original line endings in your working directory. warning: LF will be replaced by CRLF in xxxxx.
文章标题:windows | 换行符 | windows换行符号和Unix换行符
文章链接:http://soscw.com/essay/92473.html