Skip to content
vijairaj edited this page Aug 11, 2015 · 3 revisions

init-db

init-db

Initializes the git object database. First the directory .dircache/objects is created and inside that the directories 00, 01, 02 ... FF are created.

update-cache

update-cache file1 file2 ...

Creates the directory cache which is the file .dircache/index if it doesn't exist. For each file listed in the command line it first creates a blob object in the object database and then creates sorted sha1 entries in the directory cache. The purpose of the directory cache is to record the snapshot of the current state of the tracked files. To support quick detection of changes to the tracked files, it also stores the file timestamps, size, permission and inode information.

show-diff

show-diff

Compares the current contents of the tracked files with the snapshot that was created the last time update-cache was called. The actual contents are compared only when there is change in at least one of the file attributes such as file timestamp, permission, inode or size.

cat-file

cat-file <sha1>

Reads the sha1 object from the db and stores it in the current directory as a temp file of the format temp_git_file_XXXXXX. The sha1 object can be any type: a blob (file content), a tree or a commit.

write-tree

write-tree

Writes the tree object to the object db from the directory cache which was last updated using update-cache. The tree object is basically a simpler version of the directory cache and contains the list of files along with their permissions and sha1 hashes.

commit-tree

commit-tree <sha1> [-p <sha1>]* < changelog

Write the commit object to the object db. A commit object links to a tree object and zero or more parent commit objects effectively forming a tree.

read-tree

read-tree <sha1>

Reads a tree object from the object db, parses the object and prints the list of files along with their name, mode and sha1.

Clone this wiki locally