注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

牧笔临风

己有能,勿自私!

 
 
 

日志

 
 
 
 

git 对象(.git/objects)  

2015-04-14 11:02:54|  分类: git |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

objects为git对象存着真实的目录数据。对于objects有以下操作命令及参数:
git cat-fle
     -t
   Instead of the content, show the object type identified by <object>.

-s
   Instead of the content, show the object size identified by <object>.

-e
   Suppress all output; instead exit with zero status if <object> exists and is a valid object.

-p
   Pretty-print the contents of <object> based on its type.

-p
   Pretty-print the contents of <object> based on its type.

<type>
   Typically this matches the real type of <object> but asking for a type that can trivially be
   dereferenced from the given <object> is also permitted. An example is to ask for a "tree" with
   <object> being a commit object that contains it, or to ask for a "blob" with <object> being a tag
   object that points at it.

--textconv
   Show the content as transformed by a textconv filter. In this case, <object> has be of the form
   <treeish>:<path>, or :<path> in order to apply the filter to the content recorded in the index at
   <path>.

--batch
   Print the SHA-1, type, size, and contents of each object provided on stdin. May not be combined with
   any other options or arguments.

--batch-check
   Print the SHA-1, type, and size of each object provided on stdin. May not be combined with any other
   options or arguments.

我们来看一次提交涉及的sha1值:
git 对象(.git/objects) - rock - 牧笔临风
这里涉及到三个sha1值,commit、tree和parent
commit 保存着基础信息,包含本次提交的sha1,注释,父节点的id
tree 保存着文件的基本信息,文件内容保存在tree中id对应的文件里
parent 父节点信息
文件内容通过下面命令:
[yanqing4@localhost sample]$ git cat-file -p  be0767d1b
100644 blob 6ad9396c22bffa93eb2afd85b9af71daaccc2b2e    a.txt
获得id为:6ad9396c22bffa93eb2afd85b9af71daaccc2b2e
再通过 git cat-file -p 6ad9396可以获得。
文件保存在.git/objects中上面前两位红色对应objects目录索引,后38绿色位为目录名。
[yanqing4@localhost sample]$ ls .git/objects/6a/
d9396c22bffa93eb2afd85b9af71daaccc2b2e

更详细的信息参考:http://git-scm.com/book/zh/ch9-2.html
 



  评论这张
 
阅读(62)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017