当前位置: 主页 > 系统 >

配置git正确处理换行符问题

时间:2022-06-25  作者:haden   点击:
【摘要】Every time you press `return` on your keyboard you insert an invisible character called a line ending. Different operating systems handle line endings differently.When you're collaborating on projects with Git and GitHub, Git might produce u

Every time you press return on your keyboard you insert an invisible character called a line ending. Different operating systems handle line endings differently.

When you’re collaborating on projects with Git and GitHub, Git might produce unexpected results if, for example, you’re working on a Windows machine, and your collaborator has made a change in macOS.

You can configure Git to handle line endings automatically so you can collaborate effectively with people who use different operating systems.

每次按下回车的时候都会插入一个看不见的“换行符”。不同的操作系统处理换行符不同。

当使用Git或GitHub合作开发项目的时候,如果你在Windows平台开发,你的合作者在macOS上修改的代码,Git可能会产生一些意外的结果。

你可以配置Git来自动的处理换行符,这样可以更高效的在不同操作系统合作开发。

  1. 全局处理换行符
  2. 每个库单独设置

https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
验证码: 点击我更换图片

推荐内容