]>
Commit | Line | Data |
---|---|---|
2cf565c5 DG |
1 | git-cat-file(1) |
2 | =============== | |
2cf565c5 DG |
3 | |
4 | NAME | |
5 | ---- | |
c3f0baac | 6 | git-cat-file - Provide content or type/size information for repository objects |
2cf565c5 DG |
7 | |
8 | ||
9 | SYNOPSIS | |
10 | -------- | |
cdf222f5 | 11 | [verse] |
b1889c36 JN |
12 | 'git cat-file' [-t | -s | -e | -p | <type>] <object> |
13 | 'git cat-file' [--batch | --batch-check] < <list-of-objects> | |
2cf565c5 DG |
14 | |
15 | DESCRIPTION | |
16 | ----------- | |
05d5667f AR |
17 | In the first form, provides content or type of objects in the repository. The |
18 | type is required unless '-t' or '-p' is used to find the object type, or '-s' | |
19 | is used to find the object size. | |
20 | ||
21 | In the second form, a list of object (separated by LFs) is provided on stdin, | |
22 | and the SHA1, type, and size of each object is printed on stdout. | |
2cf565c5 DG |
23 | |
24 | OPTIONS | |
25 | ------- | |
26 | <object>:: | |
8933364d AK |
27 | The name of the object to show. |
28 | For a more complete list of ways to spell object names, see | |
5162e697 | 29 | "SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1]. |
2cf565c5 DG |
30 | |
31 | -t:: | |
32 | Instead of the content, show the object type identified by | |
33 | <object>. | |
34 | ||
62bb9960 JH |
35 | -s:: |
36 | Instead of the content, show the object size identified by | |
37 | <object>. | |
38 | ||
7950571a PA |
39 | -e:: |
40 | Suppress all output; instead exit with zero status if <object> | |
41 | exists and is a valid object. | |
42 | ||
ed90cbf5 JK |
43 | -p:: |
44 | Pretty-print the contents of <object> based on its type. | |
45 | ||
2cf565c5 DG |
46 | <type>:: |
47 | Typically this matches the real type of <object> but asking | |
f73ae1fc | 48 | for a type that can trivially be dereferenced from the given |
2cf565c5 DG |
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 | ||
a8128ed6 AR |
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 | ||
05d5667f AR |
58 | --batch-check:: |
59 | Print the SHA1, type, and size of each object provided on stdin. May not be | |
60 | combined with any other options or arguments. | |
61 | ||
2cf565c5 DG |
62 | OUTPUT |
63 | ------ | |
7950571a PA |
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. | |
2cf565c5 | 69 | |
ed90cbf5 JK |
70 | If '-p' is specified, the contents of <object> are pretty-printed. |
71 | ||
05d5667f AR |
72 | If <type> is specified, the raw (though uncompressed) contents of the <object> |
73 | will be returned. | |
74 | ||
a8128ed6 AR |
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 | ||
05d5667f | 83 | If '--batch-check' is specified, output of the following form is printed for |
1168d402 | 84 | each object specified on stdin: |
05d5667f AR |
85 | |
86 | ------------ | |
87 | <sha1> SP <type> SP <size> LF | |
88 | ------------ | |
89 | ||
a8128ed6 AR |
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: | |
2cf565c5 | 92 | |
05d5667f AR |
93 | ------------ |
94 | <object> SP missing LF | |
95 | ------------ | |
2cf565c5 DG |
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 | --- | |
9e1f0a85 | 107 | Part of the linkgit:git[1] suite |