blob: 84ee92e15844588425111c1230b37ac3f0f03038 [file] [log] [blame]
Junio C Hamano7ad22dc2007-01-29 02:55:481git-fsck(1)
2===========
3
4NAME
5----
6git-fsck - Verifies the connectivity and validity of the objects in the database
7
8
9SYNOPSIS
10--------
11[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3812'git fsck' [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]
Junio C Hamano92887a32011-12-07 00:26:2913 [--[no-]full] [--strict] [--verbose] [--lost-found]
Junio C Hamanod7ed4042015-08-03 19:43:0014 [--[no-]dangling] [--[no-]progress] [--connectivity-only] [<object>*]
Junio C Hamano7ad22dc2007-01-29 02:55:4815
16DESCRIPTION
17-----------
18Verifies the connectivity and validity of the objects in the database.
19
20OPTIONS
21-------
22<object>::
23An object to treat as the head of an unreachability trace.
24+
Junio C Hamano1aa40d22010-01-21 17:46:4325If no objects are given, 'git fsck' defaults to using the
Junio C Hamanoe3f080d2013-04-22 02:27:1326index file, all SHA-1 references in `refs` namespace, and all reflogs
Junio C Hamanod0316112012-08-22 19:55:2927(unless --no-reflogs is given) as heads.
Junio C Hamano7ad22dc2007-01-29 02:55:4828
29--unreachable::
Junio C Hamano3d050d62011-05-17 06:43:3430Print out objects that exist but that aren't reachable from any
Junio C Hamano7ad22dc2007-01-29 02:55:4831of the reference nodes.
32
Junio C Hamano3d1b5a12013-05-17 23:34:0233--[no-]dangling::
Junio C Hamano81d540a2012-03-02 19:52:4734Print objects that exist but that are never 'directly' used (default).
Junio C Hamanoa5a62162012-03-05 23:25:4335`--no-dangling` can be used to omit this information from the output.
Junio C Hamano81d540a2012-03-02 19:52:4736
Junio C Hamano7ad22dc2007-01-29 02:55:4837--root::
38Report root nodes.
39
40--tags::
41Report tags.
42
43--cache::
44Consider any object recorded in the index also as a head node for
45an unreachability trace.
46
Junio C Hamano5678d692007-04-06 00:51:4347--no-reflogs::
48Do not consider commits that are referenced only by an
49entry in a reflog to be reachable. This option is meant
50only to search for commits that used to be in a ref, but
51now aren't, but are still in that corresponding reflog.
52
Junio C Hamano7ad22dc2007-01-29 02:55:4853--full::
54Check not just objects in GIT_OBJECT_DIRECTORY
55($GIT_DIR/objects), but also the ones found in alternate
56object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES
57or $GIT_DIR/objects/info/alternates,
Junio C Hamano076ffcc2013-02-06 05:13:2158and in packed Git archives found in $GIT_DIR/objects/pack
Junio C Hamano7ad22dc2007-01-29 02:55:4859and corresponding pack subdirectories in alternate
Junio C Hamano621e1232009-10-26 05:16:4760object pools. This is now default; you can turn it off
61with --no-full.
Junio C Hamano7ad22dc2007-01-29 02:55:4862
Junio C Hamanod7ed4042015-08-03 19:43:0063--connectivity-only::
64Check only the connectivity of tags, commits and tree objects. By
65avoiding to unpack blobs, this speeds up the operation, at the
66expense of missing corrupt objects or other problematic issues.
67
Junio C Hamano7ad22dc2007-01-29 02:55:4868--strict::
69Enable more strict checking, namely to catch a file mode
70recorded with g+w bit set, which was created by older
Junio C Hamano076ffcc2013-02-06 05:13:2171versions of Git. Existing repositories, including the
72Linux kernel, Git itself, and sparse repository have old
Junio C Hamano7ad22dc2007-01-29 02:55:4873objects that triggers this check, but it is recommended
74to check new projects with this flag.
75
Junio C Hamano58aece12007-06-05 09:01:3576--verbose::
77Be chatty.
78
Junio C Hamano1d90cb02007-07-03 07:05:3179--lost-found::
Junio C Hamanoa196f6d2007-07-24 08:10:2780Write dangling objects into .git/lost-found/commit/ or
81.git/lost-found/other/, depending on type. If the object is
82a blob, the contents are written into the file, rather than
83its object name.
Junio C Hamano1d90cb02007-07-03 07:05:3184
Junio C Hamano3d1b5a12013-05-17 23:34:0285--[no-]progress::
Junio C Hamano92887a32011-12-07 00:26:2986Progress status is reported on the standard error stream by
87default when it is attached to a terminal, unless
88--no-progress or --verbose is specified. --progress forces
89progress status even if the standard error stream is not
90directed to a terminal.
91
Junio C Hamano962f3a32011-12-22 20:21:4492DISCUSSION
93----------
94
Junio C Hamanoe3f080d2013-04-22 02:27:1395git-fsck tests SHA-1 and general object sanity, and it does full tracking
Junio C Hamano962f3a32011-12-22 20:21:4496of the resulting reachability and everything else. It prints out any
Junio C Hamano7ad22dc2007-01-29 02:55:4897corruption it finds (missing or bad objects), and if you use the
Junio C Hamano962f3a32011-12-22 20:21:4498'--unreachable' flag it will also print out objects that exist but that
99aren't reachable from any of the specified head nodes (or the default
100set, as mentioned above).
Junio C Hamano7ad22dc2007-01-29 02:55:48101
102Any corrupt objects you will have to find in backups or other archives
Junio C Hamanoba4b9282008-07-06 05:20:31103(i.e., you can just remove them and do an 'rsync' with some other site in
Junio C Hamano7ad22dc2007-01-29 02:55:48104the hopes that somebody else has the object you have corrupted).
105
Junio C Hamano7ad22dc2007-01-29 02:55:48106Extracted Diagnostics
107---------------------
108
109expect dangling commits - potential heads - due to lack of head information::
110You haven't specified any nodes as heads so it won't be
111possible to differentiate between un-parented commits and
112root nodes.
113
114missing sha1 directory '<dir>'::
115The directory holding the sha1 objects is missing.
116
117unreachable <type> <object>::
118The <type> object <object>, isn't actually referred to directly
119or indirectly in any of the trees or commits seen. This can
120mean that there's another root node that you're not specifying
121or that the tree is corrupt. If you haven't missed a root node
122then you might as well delete unreachable nodes since they
123can't be used.
124
125missing <type> <object>::
126The <type> object <object>, is referred to but isn't present in
127the database.
128
129dangling <type> <object>::
130The <type> object <object>, is present in the database but never
131'directly' used. A dangling commit could be a root node.
132
Junio C Hamano7ad22dc2007-01-29 02:55:48133sha1 mismatch <object>::
134The database has an object who's sha1 doesn't match the
135database value.
136This indicates a serious data integrity problem.
137
138Environment Variables
139---------------------
140
141GIT_OBJECT_DIRECTORY::
142used to specify the object database root (usually $GIT_DIR/objects)
143
144GIT_INDEX_FILE::
145used to specify the index file of the index
146
147GIT_ALTERNATE_OBJECT_DIRECTORIES::
148used to specify additional object database roots (usually unset)
149
Junio C Hamano7ad22dc2007-01-29 02:55:48150GIT
151---
Junio C Hamanof7c042d2008-06-06 22:50:53152Part of the linkgit:git[1] suite