Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify Git object type based on its SHA1 code?

Tags:

git

Given object's SHA1 code, how could one identify the object type (blob, tree, tag, or commit)?

like image 356
Misha Moroshko Avatar asked Oct 24 '11 12:10

Misha Moroshko


1 Answers

You can use git cat-file -t, e.g.:

$  git cat-file -t ffcb14ca1dad
commit
$ git cat-file -t 74e34003a
blob

This use of git cat-file is explained in its documentation.

like image 188
Mark Longair Avatar answered Oct 02 '22 09:10

Mark Longair