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++进行查看

使用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格式的,则没问题;’如果不支持这时候就会出问题,需要设置不自动转换
网友评论