Tuesday, November 15, 2011

How to identify, using git cat-file, type of an object in Git by looking at it SHA1 value

All objects in Git have a sha1 value. Git provides a way to inspect a sha1 and tell you the type of object represented by that sha1
git cat-file -t <sha1>

E.g
git cat-file -t 6a00e12055941d688466e68d6880d2bc06f12b55

This command also supports batch mode that will read a list of objects from STDIN. Just run command
git cat-file
to see all options supported by it

No comments:

Post a Comment