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.git

$ 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.shell

git cat-file

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

$ git cat-file -p 85b75207c07fe1be1e5116f73b74e1eb4a92a4a5
Hello furzoom

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

git update-index

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

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

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

git write-tree

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

$ git write-tree

git read-tree

git read-tree reads tree information into the index.spa

$ git read-tree <tree-sha1>

git commit-tree

git commit-tree create a new commit object.code

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

Three core objects in gitorm

相關文章
相關標籤/搜索