Git core objects

Git core objects

Core objects in git

  • blob object
  • tree object
  • commit object

Git low level commands

  • git hash-object
  • git cat-file
  • git update-index
  • git write-tree
  • git read-tree
  • git commit-tree

git hash-object

git hash-object used to compute object ID and optionally create a blob from a file.

$ echo "Hello furzoom" | git hash-object -w --stdin
85b75207c07fe1be1e5116f73b74e1eb4a92a4a5

-w tells hash-object to store the object. --stdin tells the command to read the content from stdin.

git cat-file

git cat-file provide content or type and size information for repository objects.

$ git cat-file -p 85b75207c07fe1be1e5116f73b74e1eb4a92a4a5
Hello furzoom

p tells cat-file to figure out the type of content and display it nicely for you.

git update-index

git update-index register file contents in the working tree to the index.

$ echo 'new file' > new.txt
$ git update-index --add new.txt

--add tells update-index to add file to index (staging area).

git write-tree

git write-tree create a tree object from the current index.

$ git write-tree

git read-tree

git read-tree reads tree information into the index.

$ git read-tree <tree-sha1>

git commit-tree

git commit-tree create a new commit object.

$ git commit-tree <tree-sha1> -p <parent-tree-sha1>

Three core objects in git

转载于:https://www.cnblogs.com/furzoom/p/7710132.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值