美文网首页
git 使用相关

git 使用相关

作者: Neucrack | 来源:发表于2017-07-14 17:39 被阅读469次

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

Web:https://git-scm.com/
Doc:https://git-scm.com/doc
中文教程:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/

使用git必须注意的事情:

1. 跨平台使用git时,文件换行符(Windows下CR LF ,linux和mac下LF)转换问题

因为不同操作系统使用的换行符不一致,Windows下使用CR LF ,linux和mac下使用LF,所以要根据情况进行转换
可以使用notepad++进行查看

notepad++查看换行符

使用AutoCRLF参数设置是否转换

* 提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true

* 提交时转换为LF,检出时不转换
git config --global core.autocrlf input

* 提交检出均不转换
git config --global core.autocrlf false
SafeCRLF
* 拒绝提交包含混合换行符的文件
git config --global core.safecrlf true

* 允许提交包含混合换行符的文件
git config --global core.safecrlf false

* 提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn

所以根据情况进行设定,比如在linux下编辑,则文件是LF换行,提交到云端时无论设不设置都一样,当需要克隆到Windows时,如果设置了检出自动转换,克隆下来的文件是CRLF结尾的,如果编译器编辑器支持CRLF格式的,则没问题;’如果不支持这时候就会出问题,需要设置不自动转换

参考:git 换行符LF与CRLF转换问题

相关文章

  • Git 的基本使用

    Git相关命令 安装Git 在Windows上安装Git (我是使用的Windows)在Windows上使用Git...

  • git 使用相关

    一.配置git 打开git输入以下代码: .git config --global user.name xxx #...

  • Git使用相关

    git 配置多个SSH-Key生成并部署SSH key Git 忽略一些文件不加入版本控制: 在Git中如果想忽略...

  • git 使用相关

    Git is a free and open source distributed version control...

  • Git相关使用

    一、git中的三个区 : 工作区、暂存区、Git仓库 二、git中的三种状态 : 已修改 (modified):...

  • Git使用小结

    Git使用小结 config相关 配置git用户名/邮箱账户git config --global user.na...

  • 如何使用Git

    如何使用Git 安装Git 首先,计算机中应该先把Git安装好,才可以使用Git相关的命令。 谁能告诉我,Mark...

  • git的相关使用

    webstorm克隆项目

  • git的相关使用

    .idea文件夹应该忽略的git版本控制。新从git上clone代码,可以跑的通。但是发现会有一些.idea文件被...

  • git使用相关命令

    1、提交 git commit -m "注释" 文件名 2、查看提交日志 3、回退到某个版本 git reset ...

网友评论

      本文标题:git 使用相关

      本文链接:https://www.haomeiwen.com/subject/btdohxtx.html