<<Git Community Book中文版>>学习笔记

<<Git Community Book中文版>>


Git对象模型


  SHA: 表示项目历史信息的文件,通过一个40个字符的"对象名"来索引。


  对象: 
    三个部分:类型、大小和内容
    分四个类型: blob, tree, commit, tag
      blob: 存储文件数据
      tree: 管理tree和blob
      commit: 指向一个tree,标记项目某特定时间点的状态
      tag: 标记一个commit的方法
    命令: 
      git ls-tree tree_sha1; 
      git show blob_sha1; 
      git log , git show -s --pretty=raw commit_sha1;
      git cat-file tag v1.5;

  
Git目录与工作目录
  Git目录
  工作目录


Git索引:工作目录和项目仓库间的暂存区。提交的是索引里的内容。
  git status


安装Git
  linux:
    $ yum install git-core
    $ apt-get install git-core
  Windows:
    下载安装msysGit


配置
  git config --global user.name 'yourname'
  git config --global user.email 'your email'




基本用法
  git clone git://git.kernel.org/pub/scm/git/git.git
  git clone http://www.kernel.org/pub/scm/git/git.git


  git init
  git add file1 file2 | git add .
  git diff --cached
  git status
  git commit -m 'commit' | git commit -a


  git branch
  git branch branch_name
  git checkout branch_name | git checkout master
  git merge branch_name
  git diff //查看冲突
  gitk //图形显示项目历史
  git branch -d local | git branch -D local //delete

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值