Git学习之一

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




  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值