1.git全局参数设置
1.1查看版本
$ git --version
1.2.配置用户名和邮箱地址,在版本库提交时用到
$ git config --global user.name "yinnana"
$ git config --global user.email "nanayin@creditease.cn"
1.3.设置git别名,以便可以使用更为简洁的子命令
$ git config --global alias.st status
1.4.在git命令输出中开启颜色显示
$ git config --global color.ui true
1.5.禁止换行符的转换
$ git config --global core.autocrlf false
2.初始化版本库
1.初始化
$ git init gitdemo
$ cd gitdemo
$ ls -aF
./ ../ .git/
.git 目录就是git版本库(repository)
所在的目录(F:\gitdemo)被称为 工作区,当前工作区除了包含一个隐藏的.git版本库目录外空无一物。
3.创建一个文件aa.txt,内容为"hello"
$ echo "hello" >aa.txt
4.将文件添加到版本库:
$ git add aa.txt
nanayin@201605050385- MINGW64 /f/gitdemo (master)
$ git commit -m 'initialized'
[master (root-commit) df69eb9] initialized
warning: LF will be replaced by CRLF in welcome.txt.
The file will have its original line endings in your working directory.
1 file changed, 1 insertion(+)
create mode 100644 aa.txt
CRLF -- Carriage-Return Line-Feed 回车(CR, ASCII 13, \r) 换行(LF, ASCII 10, \n)
windows中的换行符为 CRLF, 而在linux下的换行符为:LF
使用git来生成一个文件后,文件中的换行符为LF, 当执行git add .时,系统提示:LF 将被转换成 CRLF
解决办法,上述1.5 禁止换行符的转换