list of all commits SHA1_HASH

Posted by dorelal on Stack Overflow See other posts from Stack Overflow or by dorelal
Published on 2010-03-27T20:49:38Z Indexed on 2010/03/27 20:53 UTC
Read the original article Hit count: 154

Filed under:
git init
echo 'I am foo' > foo.txt
git add foo.txt # this woould create a git commit object
echo ' I am foo2' > foo.txt
git add foo.txt # this would create another git commit object
git commit -m 'doe' # this would create two git 
                    # objects: one commit object and one tree object

How do I get a list of all 4 commits SHA1_HASH ?

cd .git/objects
ls
(master)$ ls -al
total 0
drwxr-xr-x   8 nsingh  staff  272 Mar 27 16:44 .
drwxr-xr-x  13 nsingh  staff  442 Mar 27 16:44 ..
drwxr-xr-x   3 nsingh  staff  102 Mar 27 16:44 37
drwxr-xr-x   3 nsingh  staff  102 Mar 27 16:43 a2
drwxr-xr-x   3 nsingh  staff  102 Mar 27 16:44 e1
drwxr-xr-x   3 nsingh  staff  102 Mar 27 16:42 e6
drwxr-xr-x   2 nsingh  staff   68 Mar 27 16:42 info
drwxr-xr-x   2 nsingh  staff   68 Mar 27 16:42 pack

I can find the list of all 4 commits by looking at file here but there must be a better way.

© Stack Overflow or respective owner

Related posts about git