Skip to content

Instantly share code, notes, and snippets.

@anildigital
Created July 4, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anildigital/78c882a48b46d140cfac to your computer and use it in GitHub Desktop.
Save anildigital/78c882a48b46d140cfac to your computer and use it in GitHub Desktop.
Git Object Model - Commands used
# Prints unique sha1 for the file
git hash-object data/number.txt
#Lists commit object ids
git rev-list --objects —all
# Lists out the git objects
find .git/objects -type f
# Lists files added to git index
git ls-files --stage
# Prints out the type of object
git cat-file -t 0858981994133d5893a4565fc7a84ffab6409007
# Prints out the contents of the object
git cat-file -p 0858981994133d5893a4565fc7a84ffab6409007
# Prints out the contetns of the blob
git cat-file blob 0858981994133d5893a4565fc7a84ffab6409007
# Writes the tree. Creates a tree object
git write-tree
# Creates a git commit object from the tree.
echo "msg" | git commit-tree 0858981994133d5893a4565fc7a84ffab6409007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment