Git 简明教程
Git - Different Platforms
GNU/Linux 和 Mac OS 使用 line-feed (LF) 或新行作为换行符,而 Windows 使用 line-feed and carriage-return (LFCR) 组合来表示换行符。
GNU/Linux and Mac OS uses line-feed (LF), or new line as line ending character, while Windows uses line-feed and carriage-return (LFCR) combination to represent the line-ending character.
为了避免由于这些换行符差异而导致不必要的提交,我们必须将 Git 客户端配置为向 Git 存储库写入相同的换行符。
To avoid unnecessary commits because of these line-ending differences, we have to configure the Git client to write the same line ending to the Git repository.
对于 Windows 系统,我们可以在签出时将 Git 客户端配置为将换行符转换为 CRLF 格式,并在提交操作期间将它们转换回 LF 格式。以下设置将执行所需操作。
For Windows system, we can configure the Git client to convert line endings to CRLF format while checking out, and convert them back to LF format during the commit operation. The following settings will do the needful.
[tom@CentOS project]$ git config --global core.autocrlf true
对于 GNU/Linux 或 Mac OS,我们在执行签出操作时,可以将 Git 客户端配置为将换行符从 CRLF 转换为 LF 。
For GNU/Linux or Mac OS, we can configure the Git client to convert line endings from CRLF to LF while performing the checkout operation.
[tom@CentOS project]$ git config --global core.autocrlf input