git官网: http://git-scm.com/
英文教程: http://www.git-tower.com/learn/
中文教程: http://gitbook.liuhui998.com/index.html
查看配置
$ git config -l #查看配置信息
$ git config --global user.name "diong"
$ git config --global user.email "wu***@163.com"
创建工程
$ git init #创建本地库
$ git clone https://github.com/diong/gitFirst.git #从网上已有工程拷贝
添加文件
$ git add -A #添加本地文件到版本控制中
移除文件
$ git rm error.html
忽略文件
1. 在工程目录下创建文件".gitignore"
2. 在里面添加忽略文件(类型)
# a comment - this is ignored
# no .a files
*.a
# but do track lib.a, even though you're ignoring .a files above
!lib.a
# only ignore the root TODO file, not subdir/TODO
/TODO
# ignore all files in the build/ directory
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .txt files in the doc/ directory
doc/**/*.txt
查看状态
$ git status
查看日志信息
$ git log
提交
$ git commit -m "Initial commit" #提交 -m 添加备注信息
push到GitHub
1. 先在GitHub中创建对应的工程目录(gitFirst)
2. $ git remote add origin https://github.com/diong/gitFirst.git
3. $ git push -u origin master