Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-cat-file(1) |
| 2 | =============== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 6 | git-cat-file - Provide content or type and size information for repository objects |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | dc8f25b | 2008-06-11 07:52:28 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | 9f10ed3 | 2009-05-26 08:38:52 | [diff] [blame] | 12 | 'git cat-file' (-t | -s | -e | -p | <type>) <object> |
| 13 | 'git cat-file' (--batch | --batch-check) < <list-of-objects> |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 14 | |
| 15 | DESCRIPTION |
| 16 | ----------- |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 17 | In its first form, the command provides the content or the type of an object in |
| 18 | the repository. The type is required unless '-t' or '-p' is used to find the |
| 19 | object type, or '-s' is used to find the object size. |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 20 | |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 21 | In the second form, a list of objects (separated by linefeeds) is provided on |
| 22 | stdin, and the SHA1, type, and size of each object is printed on stdout. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 23 | |
| 24 | OPTIONS |
| 25 | ------- |
| 26 | <object>:: |
Junio C Hamano | 8f62db9 | 2007-02-01 00:22:22 | [diff] [blame] | 27 | The name of the object to show. |
| 28 | For a more complete list of ways to spell object names, see |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 29 | the "SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1]. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 30 | |
| 31 | -t:: |
| 32 | Instead of the content, show the object type identified by |
| 33 | <object>. |
| 34 | |
| 35 | -s:: |
| 36 | Instead of the content, show the object size identified by |
| 37 | <object>. |
| 38 | |
| 39 | -e:: |
| 40 | Suppress all output; instead exit with zero status if <object> |
| 41 | exists and is a valid object. |
| 42 | |
Junio C Hamano | 8eb323c | 2006-05-25 05:55:22 | [diff] [blame] | 43 | -p:: |
| 44 | Pretty-print the contents of <object> based on its type. |
| 45 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 46 | <type>:: |
| 47 | Typically this matches the real type of <object> but asking |
| 48 | for a type that can trivially be dereferenced from the given |
| 49 | <object> is also permitted. An example is to ask for a |
| 50 | "tree" with <object> being a commit object that contains it, |
| 51 | or to ask for a "blob" with <object> being a tag object that |
| 52 | points at it. |
| 53 | |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 54 | --batch:: |
| 55 | Print the SHA1, type, size, and contents of each object provided on |
| 56 | stdin. May not be combined with any other options or arguments. |
| 57 | |
| 58 | --batch-check:: |
Junio C Hamano | 1de7572 | 2009-03-26 08:39:38 | [diff] [blame] | 59 | Print the SHA1, type, and size of each object provided on stdin. May not |
| 60 | be combined with any other options or arguments. |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 61 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 62 | OUTPUT |
| 63 | ------ |
| 64 | If '-t' is specified, one of the <type>. |
| 65 | |
| 66 | If '-s' is specified, the size of the <object> in bytes. |
| 67 | |
| 68 | If '-e' is specified, no output. |
| 69 | |
Junio C Hamano | 8eb323c | 2006-05-25 05:55:22 | [diff] [blame] | 70 | If '-p' is specified, the contents of <object> are pretty-printed. |
| 71 | |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 72 | If <type> is specified, the raw (though uncompressed) contents of the <object> |
| 73 | will be returned. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 74 | |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 75 | If '--batch' is specified, output of the following form is printed for each |
| 76 | object specified on stdin: |
| 77 | |
| 78 | ------------ |
| 79 | <sha1> SP <type> SP <size> LF |
| 80 | <contents> LF |
| 81 | ------------ |
| 82 | |
| 83 | If '--batch-check' is specified, output of the following form is printed for |
Junio C Hamano | cb1c44f | 2008-08-06 06:19:33 | [diff] [blame] | 84 | each object specified on stdin: |
Junio C Hamano | dfccbb0 | 2008-05-26 01:16:14 | [diff] [blame] | 85 | |
| 86 | ------------ |
| 87 | <sha1> SP <type> SP <size> LF |
| 88 | ------------ |
| 89 | |
| 90 | For both '--batch' and '--batch-check', output of the following form is printed |
| 91 | for each object specified on stdin that does not exist in the repository: |
| 92 | |
| 93 | ------------ |
| 94 | <object> SP missing LF |
| 95 | ------------ |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 96 | |
| 97 | Author |
| 98 | ------ |
| 99 | Written by Linus Torvalds <torvalds@osdl.org> |
| 100 | |
| 101 | Documentation |
| 102 | -------------- |
| 103 | Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. |
| 104 | |
| 105 | GIT |
| 106 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 107 | Part of the linkgit:git[1] suite |