nanayin@201605050385- MINGW64 /f/gitdemo (master)
$ git log -l --pretty=raw
commit 492478d7ebc1e6bc7104e585c6fe2b38185521c3
Author: yinnana <nanayin@creditease.cn>
Date:   Wed Jan 4 13:53:11 2017 +0800

    test

commit 268afa36b9b348228fd2fc77b12423d9e97d710b
Author: yinnana <nanayin@creditease.cn>
Date:   Wed Jan 4 13:13:50 2017 +0800

    test

commit df69eb991294825b467ca423d38aedd4117ca0f1
Author: yinnana <nanayin@creditease.cn>
Date:   Wed Jan 4 12:35:39 2017 +0800

    initialized
nanayin@201605050385- MINGW64 /f/gitdemo (master)
$ git cat-file -t  492478d7e
commit
nanayin@201605050385- MINGW64 /f/gitdemo (master)
$ git cat-file -p 492478d7e
tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
parent 268afa36b9b348228fd2fc77b12423d9e97d710b
author yinnana <nanayin@creditease.cn> 1483509191 +0800
committer yinnana <nanayin@creditease.cn> 1483509191 +0800

test

nanayin@201605050385- MINGW64 /f/gitdemo (master)
$ for id in 492478d7e 268afa36b9 df69eb991;do \
> ls .git/objects/${id:0:2}/${id:2}*;done                                       .git/objects/49/2478d7ebc1e6bc7104e585c6fe2b38185521c3
.git/objects/26/8afa36b9b348228fd2fc77b12423d9e97d710b
.git/objects/df/69eb991294825b467ca423d38aedd4117ca0f1

master分支的实现:

$ git log -l HEAD
$ git log -l master
$ git log -l refs/heads/master
$ git rev-parse master
df33bea3141db42c47dfb8fc2ce1d1d9416100e2

$ git rev-parse refs/heads/master
df33bea3141db42c47dfb8fc2ce1d1d9416100e2

$ git rev-parse head
df33bea3141db42c47dfb8fc2ce1d1d9416100e2
$ find .git -name HEAD -o -name master
.git/HEAD
.git/logs/HEAD
.git/logs/refs/heads/master
.git/refs/heads/master


Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐