]>
Commit | Line | Data |
---|---|---|
2cf565c5 DG |
1 | git-cat-file(1) |
2 | =============== | |
2cf565c5 DG |
3 | |
4 | NAME | |
5 | ---- | |
d83a42f3 | 6 | git-cat-file - Provide content or type and size information for repository objects |
2cf565c5 DG |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
cdf222f5 | 11 | [verse] |
9f77fe02 | 12 | 'git cat-file' (-t | -s | -e | -p | <type> | --textconv ) <object> |
0e5168fd | 13 | 'git cat-file' (--batch | --batch-check) < <list-of-objects> |
2cf565c5 DG |
14 | |
15 | DESCRIPTION | |
16 | ----------- | |
d83a42f3 DM |
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 | |
9f77fe02 MG |
19 | object type, or '-s' is used to find the object size, or '--textconv' is used |
20 | (which implies type "blob"). | |
05d5667f | 21 | |
d83a42f3 DM |
22 | In the second form, a list of objects (separated by linefeeds) is provided on |
23 | stdin, and the SHA1, type, and size of each object is printed on stdout. | |
2cf565c5 DG |
24 | |
25 | OPTIONS | |
26 | ------- | |
27 | <object>:: | |
8933364d AK |
28 | The name of the object to show. |
29 | For a more complete list of ways to spell object names, see | |
f028cdae | 30 | the "SPECIFYING REVISIONS" section in linkgit:gitrevisions[1]. |
2cf565c5 DG |
31 | |
32 | -t:: | |
33 | Instead of the content, show the object type identified by | |
34 | <object>. | |
35 | ||
62bb9960 JH |
36 | -s:: |
37 | Instead of the content, show the object size identified by | |
38 | <object>. | |
39 | ||
7950571a PA |
40 | -e:: |
41 | Suppress all output; instead exit with zero status if <object> | |
42 | exists and is a valid object. | |
43 | ||
ed90cbf5 JK |
44 | -p:: |
45 | Pretty-print the contents of <object> based on its type. | |
46 | ||
2cf565c5 DG |
47 | <type>:: |
48 | Typically this matches the real type of <object> but asking | |
f73ae1fc | 49 | for a type that can trivially be dereferenced from the given |
2cf565c5 DG |
50 | <object> is also permitted. An example is to ask for a |
51 | "tree" with <object> being a commit object that contains it, | |
52 | or to ask for a "blob" with <object> being a tag object that | |
53 | points at it. | |
54 | ||
9f77fe02 MG |
55 | --textconv:: |
56 | Show the content as transformed by a textconv filter. In this case, | |
57 | <object> has be of the form <treeish>:<path>, or :<path> in order | |
58 | to apply the filter to the content recorded in the index at <path>. | |
59 | ||
a8128ed6 AR |
60 | --batch:: |
61 | Print the SHA1, type, size, and contents of each object provided on | |
62 | stdin. May not be combined with any other options or arguments. | |
63 | ||
05d5667f | 64 | --batch-check:: |
d83a42f3 DM |
65 | Print the SHA1, type, and size of each object provided on stdin. May not |
66 | be combined with any other options or arguments. | |
05d5667f | 67 | |
2cf565c5 DG |
68 | OUTPUT |
69 | ------ | |
7950571a PA |
70 | If '-t' is specified, one of the <type>. |
71 | ||
72 | If '-s' is specified, the size of the <object> in bytes. | |
73 | ||
74 | If '-e' is specified, no output. | |
2cf565c5 | 75 | |
ed90cbf5 JK |
76 | If '-p' is specified, the contents of <object> are pretty-printed. |
77 | ||
05d5667f AR |
78 | If <type> is specified, the raw (though uncompressed) contents of the <object> |
79 | will be returned. | |
80 | ||
a8128ed6 AR |
81 | If '--batch' is specified, output of the following form is printed for each |
82 | object specified on stdin: | |
83 | ||
84 | ------------ | |
85 | <sha1> SP <type> SP <size> LF | |
86 | <contents> LF | |
87 | ------------ | |
88 | ||
05d5667f | 89 | If '--batch-check' is specified, output of the following form is printed for |
1168d402 | 90 | each object specified on stdin: |
05d5667f AR |
91 | |
92 | ------------ | |
93 | <sha1> SP <type> SP <size> LF | |
94 | ------------ | |
95 | ||
a8128ed6 AR |
96 | For both '--batch' and '--batch-check', output of the following form is printed |
97 | for each object specified on stdin that does not exist in the repository: | |
2cf565c5 | 98 | |
05d5667f AR |
99 | ------------ |
100 | <object> SP missing LF | |
101 | ------------ | |
2cf565c5 DG |
102 | |
103 | Author | |
104 | ------ | |
105 | Written by Linus Torvalds <torvalds@osdl.org> | |
106 | ||
107 | Documentation | |
108 | -------------- | |
109 | Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. | |
110 | ||
111 | GIT | |
112 | --- | |
9e1f0a85 | 113 | Part of the linkgit:git[1] suite |