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>
作者:马 岩(Furzoom) (http://www.cnblogs.com/furzoom/)
版权声明:本文的版权归作者与博客园共同所有。转载时请在明显地方注明本文的详细链接,未经作者同意请不要删除此段声明,感谢您为保护知识产权做出的贡献。
版权声明:本文的版权归作者与博客园共同所有。转载时请在明显地方注明本文的详细链接,未经作者同意请不要删除此段声明,感谢您为保护知识产权做出的贡献。