git

 

git的每次commit 都进行一次快照存储,创建分支仅是创建一个指向对应快照的指针。

 

一、基本命令
  1、git status : 查看项目状态
  2、git add : 添加到暂存区
  3、git commit : 提交到本地仓库
  4、git push : 提交到远程仓库
  5、git clone : 克隆仓库
  6、git config --list : 查看配置文件列表
  7、git config --type : 修改配置
    type:
      system级别:整个系统的配置。
      global级别:该用户下的配置。
      local级别:当前仓库下的配置。
  8、git reset HEAD : 回滚暂存区
  9、git checkout -- <file> : 回滚工作区
  10、git log : 查看历史

  11、git diff : 比较不同

     diff --git a/file(旧) b/file(新)
      --- file 旧
      +++ file 新
      + 代表新加入
      - 代表缺少的
  
12、git rm file : 删除工作树,暂存树

  分支
  13、git branch branchName : 创建分支
    -d / --delete : 删除分支
  14、git checkout branchName : 切换分支
  15、git merge branchName : 将branchName合并到当前分支

二、github
  1、仓库(Repository)一般是项目名称
  2、收藏(Star)
  3、克隆项目(fork)
  4、pull request 将克隆项目的改动,提交给源项目。
  5、关注(Watch)
  6、Issue 问题

三、理论
  1、三棵树(非常重要
    1.1、工作区
    1.2、暂存区
    1.3、本地仓库

 

 

示意图:

 

 

 

 git diff 

 

posted @ 2019-09-22 11:26  陈标  阅读(128)  评论(0)    收藏  举报