1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
\r
4 <article lang="en" id="git-fsck(1)">
\r
6 <title>git-fsck(1)</title>
\r
8 <primary>git-fsck(1)</primary>
\r
11 <simplesect id="_name">
\r
13 <simpara>git-fsck - Verifies the connectivity and validity of the objects in the database</simpara>
\r
15 <simplesect id="_synopsis">
\r
16 <title>SYNOPSIS</title>
\r
18 <literallayout><emphasis>git fsck</emphasis> [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]
\r
19 [--full] [--strict] [--verbose] [--lost-found] [<object>*]</literallayout>
\r
22 <simplesect id="_description">
\r
23 <title>DESCRIPTION</title>
\r
24 <simpara>Verifies the connectivity and validity of the objects in the database.</simpara>
\r
26 <simplesect id="_options">
\r
27 <title>OPTIONS</title>
\r
35 An object to treat as the head of an unreachability trace.
\r
37 <simpara>If no objects are given, <emphasis>git-fsck</emphasis> defaults to using the
\r
38 index file, all SHA1 references in .git/refs/*, and all reflogs (unless
\r
39 --no-reflogs is given) as heads.</simpara>
\r
48 Print out objects that exist but that aren’t readable from any
\r
49 of the reference nodes.
\r
79 Consider any object recorded in the index also as a head node for
\r
80 an unreachability trace.
\r
90 Do not consider commits that are referenced only by an
\r
91 entry in a reflog to be reachable. This option is meant
\r
92 only to search for commits that used to be in a ref, but
\r
93 now aren’t, but are still in that corresponding reflog.
\r
103 Check not just objects in GIT_OBJECT_DIRECTORY
\r
104 ($GIT_DIR/objects), but also the ones found in alternate
\r
105 object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES
\r
106 or $GIT_DIR/objects/info/alternates,
\r
107 and in packed git archives found in $GIT_DIR/objects/pack
\r
108 and corresponding pack subdirectories in alternate
\r
119 Enable more strict checking, namely to catch a file mode
\r
120 recorded with g+w bit set, which was created by older
\r
121 versions of git. Existing repositories, including the
\r
122 Linux kernel, git itself, and sparse repository have old
\r
123 objects that triggers this check, but it is recommended
\r
124 to check new projects with this flag.
\r
144 Write dangling objects into .git/lost-found/commit/ or
\r
145 .git/lost-found/other/, depending on type. If the object is
\r
146 a blob, the contents are written into the file, rather than
\r
152 <simpara>It tests SHA1 and general object sanity, and it does full tracking of
\r
153 the resulting reachability and everything else. It prints out any
\r
154 corruption it finds (missing or bad objects), and if you use the
\r
155 <emphasis>--unreachable</emphasis> flag it will also print out objects that exist but
\r
156 that aren’t readable from any of the specified head nodes.</simpara>
\r
157 <simpara>So for example</simpara>
\r
158 <literallayout class="monospaced">git fsck --unreachable HEAD \
\r
159 $(git for-each-ref --format="%(objectname)" refs/heads)</literallayout>
\r
160 <simpara>will do quite a <emphasis>lot</emphasis> of verification on the tree. There are a few
\r
161 extra validity tests to be added (make sure that tree objects are
\r
162 sorted properly etc), but on the whole if <emphasis>git-fsck</emphasis> is happy, you
\r
163 do have a valid tree.</simpara>
\r
164 <simpara>Any corrupt objects you will have to find in backups or other archives
\r
165 (i.e., you can just remove them and do an <emphasis>rsync</emphasis> with some other site in
\r
166 the hopes that somebody else has the object you have corrupted).</simpara>
\r
167 <simpara>Of course, "valid tree" doesn’t mean that it wasn’t generated by some
\r
168 evil person, and the end result might be crap. git is a revision
\r
169 tracking system, not a quality assurance system ;)</simpara>
\r
171 <simplesect id="_extracted_diagnostics">
\r
172 <title>Extracted Diagnostics</title>
\r
176 expect dangling commits - potential heads - due to lack of head information
\r
180 You haven’t specified any nodes as heads so it won’t be
\r
181 possible to differentiate between un-parented commits and
\r
188 missing sha1 directory <emphasis><dir></emphasis>
\r
192 The directory holding the sha1 objects is missing.
\r
198 unreachable <type> <object>
\r
202 The <type> object <object>, isn’t actually referred to directly
\r
203 or indirectly in any of the trees or commits seen. This can
\r
204 mean that there’s another root node that you’re not specifying
\r
205 or that the tree is corrupt. If you haven’t missed a root node
\r
206 then you might as well delete unreachable nodes since they
\r
207 can’t be used.
\r
213 missing <type> <object>
\r
217 The <type> object <object>, is referred to but isn’t present in
\r
224 dangling <type> <object>
\r
228 The <type> object <object>, is present in the database but never
\r
229 <emphasis>directly</emphasis> used. A dangling commit could be a root node.
\r
235 warning: git-fsck: tree <tree> has full pathnames in it
\r
239 And it shouldn’t…
\r
245 sha1 mismatch <object>
\r
249 The database has an object who’s sha1 doesn’t match the
\r
251 This indicates a serious data integrity problem.
\r
257 <simplesect id="_environment_variables">
\r
258 <title>Environment Variables</title>
\r
262 GIT_OBJECT_DIRECTORY
\r
266 used to specify the object database root (usually $GIT_DIR/objects)
\r
276 used to specify the index file of the index
\r
282 GIT_ALTERNATE_OBJECT_DIRECTORIES
\r
286 used to specify additional object database roots (usually unset)
\r
292 <simplesect id="_author">
\r
293 <title>Author</title>
\r
294 <simpara>Written by Linus Torvalds <<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>></simpara>
\r
296 <simplesect id="_documentation">
\r
297 <title>Documentation</title>
\r
298 <simpara>Documentation by David Greaves, Junio C Hamano and the git-list <<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>>.</simpara>
\r
300 <simplesect id="_git">
\r
302 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
\r