<<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 status
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
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 status
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