Git配置
安装
    yum install git
全局配置
    #设置提交用户名
    git config --global user.name "leoxu"
    #设置提交邮箱
    git config --global user.email "xucongjie1990@gmail.com"
    
    #设置分色显示
    git config --global color.ui true
    #验证全局配置
    git config -l
基本命令
    #初始化本地仓库
    git init
    git remote add origin git@xxxx.git 
    git add .
    git commit
    git push -u origin master
    #clone 远程仓库
    #Clone远程版本库
    git clone git@115.28.73.167:wangcee/demo.git
    #添加远程版本库origin
    git remote add origin git@host:project.git
git add README.md# 将工作文件修改提交到index (什么是Index,下页解释) git add . # 将所有修改过的工作文件提交到index
git reset --hard <version> # 将本地文件空间恢复为指定的版本,同时修改所有的index及本地库 git reset (--soft | --mixed | --hard) <version> <file>
git commit <file> #将修改提交到本地库
git commit
git commit -a # 将git add(或git rm)和git commit等操作都合并在一起做 git commit -am "some comments"
git revert <version> # 撤销某次提交,撤销动作本身也创建了一次提交对象 git revert HEAD # 撤销最后一次提交
    #基本diff
    git diff <file> # 比较当前文件和index文件差异 git diff
    git diff <V1> <V2> # 比较两次提交之间的差异 git diff --cached # 比较index与本地库差异
    git diff HEAD #比较工作版本与HEAD(本地库)的差异
    #提交记录
    git log
    git log <file>  # 查看该文件每次提交记录
    git log -p <file>  # 查看每次详细修改内容的diff
    git log -p -2  # 查看最近两次详细修改内容的diff