Git基本知识

一,安装

Ubuntu安装git:sudo apt-get install git-core

Centos安装git:yum install git-core

 

二,配置身份---在提交代码时可以辨别身份

git config --global user.name "username"

git config --global user.email "mail@.com"

 

三,添加提交

跳转到需要提交代码目录的路径下

git init ->.git

git add filename  //add file name

git add .     //add all file in the directory

git commit -m "commit description"

 

四,常用基本命令

忽略文件添加

    新建文件.gitignore -> 修改文件(如添加 bin/ 代表忽略当前目录bin下面的所有文件)

查看修改文件的内容 git status

     git differ + 文件的不同

撤销未提交的修改  

     git checkout + 文件

查看提交记录

    git log -1(只看一条) -p(详细)

posted @ 2017-06-06 19:45  VincentFu  阅读(225)  评论(0编辑  收藏  举报