blob: 25c431d3c552d523c79473cf10867a3cab00c259 [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 Hamano81d540a2012-03-02 19:52:4714 [--[no-]dangling] [--[no-]progress] [<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
63--strict::
64Enable more strict checking, namely to catch a file mode
65recorded with g+w bit set, which was created by older
Junio C Hamano076ffcc2013-02-06 05:13:2166versions of Git. Existing repositories, including the
67Linux kernel, Git itself, and sparse repository have old
Junio C Hamano7ad22dc2007-01-29 02:55:4868objects that triggers this check, but it is recommended
69to check new projects with this flag.
70
Junio C Hamano58aece12007-06-05 09:01:3571--verbose::
72Be chatty.
73
Junio C Hamano1d90cb02007-07-03 07:05:3174--lost-found::
Junio C Hamanoa196f6d2007-07-24 08:10:2775Write dangling objects into .git/lost-found/commit/ or
76.git/lost-found/other/, depending on type. If the object is
77a blob, the contents are written into the file, rather than
78its object name.
Junio C Hamano1d90cb02007-07-03 07:05:3179
Junio C Hamano3d1b5a12013-05-17 23:34:0280--[no-]progress::
Junio C Hamano92887a32011-12-07 00:26:2981Progress status is reported on the standard error stream by
82default when it is attached to a terminal, unless
83--no-progress or --verbose is specified. --progress forces
84progress status even if the standard error stream is not
85directed to a terminal.
86
Junio C Hamano962f3a32011-12-22 20:21:4487DISCUSSION
88----------
89
Junio C Hamanoe3f080d2013-04-22 02:27:1390git-fsck tests SHA-1 and general object sanity, and it does full tracking
Junio C Hamano962f3a32011-12-22 20:21:4491of the resulting reachability and everything else. It prints out any
Junio C Hamano7ad22dc2007-01-29 02:55:4892corruption it finds (missing or bad objects), and if you use the
Junio C Hamano962f3a32011-12-22 20:21:4493'--unreachable' flag it will also print out objects that exist but that
94aren't reachable from any of the specified head nodes (or the default
95set, as mentioned above).
Junio C Hamano7ad22dc2007-01-29 02:55:4896
97Any corrupt objects you will have to find in backups or other archives
Junio C Hamanoba4b9282008-07-06 05:20:3198(i.e., you can just remove them and do an 'rsync' with some other site in
Junio C Hamano7ad22dc2007-01-29 02:55:4899the hopes that somebody else has the object you have corrupted).
100
Junio C Hamano7ad22dc2007-01-29 02:55:48101Extracted Diagnostics
102---------------------
103
104expect dangling commits - potential heads - due to lack of head information::
105You haven't specified any nodes as heads so it won't be
106possible to differentiate between un-parented commits and
107root nodes.
108
109missing sha1 directory '<dir>'::
110The directory holding the sha1 objects is missing.
111
112unreachable <type> <object>::
113The <type> object <object>, isn't actually referred to directly
114or indirectly in any of the trees or commits seen. This can
115mean that there's another root node that you're not specifying
116or that the tree is corrupt. If you haven't missed a root node
117then you might as well delete unreachable nodes since they
118can't be used.
119
120missing <type> <object>::
121The <type> object <object>, is referred to but isn't present in
122the database.
123
124dangling <type> <object>::
125The <type> object <object>, is present in the database but never
126'directly' used. A dangling commit could be a root node.
127
Junio C Hamano7ad22dc2007-01-29 02:55:48128sha1 mismatch <object>::
129The database has an object who's sha1 doesn't match the
130database value.
131This indicates a serious data integrity problem.
132
133Environment Variables
134---------------------
135
136GIT_OBJECT_DIRECTORY::
137used to specify the object database root (usually $GIT_DIR/objects)
138
139GIT_INDEX_FILE::
140used to specify the index file of the index
141
142GIT_ALTERNATE_OBJECT_DIRECTORIES::
143used to specify additional object database roots (usually unset)
144
Junio C Hamano7ad22dc2007-01-29 02:55:48145GIT
146---
Junio C Hamanof7c042d2008-06-06 22:50:53147Part of the linkgit:git[1] suite