1GIT-FSCK(1) Git Manual GIT-FSCK(1)
2
3
4
6 git-fsck - Verifies the connectivity and validity of the objects in the
7 database
8
10 git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]
11 [--[no-]full] [--strict] [--verbose] [--lost-found]
12 [--[no-]dangling] [--[no-]progress] [--connectivity-only]
13 [--[no-]name-objects] [<object>*]
14
15
17 Verifies the connectivity and validity of the objects in the database.
18
20 <object>
21 An object to treat as the head of an unreachability trace.
22
23 If no objects are given, git fsck defaults to using the index file,
24 all SHA-1 references in refs namespace, and all reflogs (unless
25 --no-reflogs is given) as heads.
26
27 --unreachable
28 Print out objects that exist but that aren’t reachable from any of
29 the reference nodes.
30
31 --[no-]dangling
32 Print objects that exist but that are never directly used
33 (default). --no-dangling can be used to omit this information from
34 the output.
35
36 --root
37 Report root nodes.
38
39 --tags
40 Report tags.
41
42 --cache
43 Consider any object recorded in the index also as a head node for
44 an unreachability trace.
45
46 --no-reflogs
47 Do not consider commits that are referenced only by an entry in a
48 reflog to be reachable. This option is meant only to search for
49 commits that used to be in a ref, but now aren’t, but are still in
50 that corresponding reflog.
51
52 --full
53 Check not just objects in GIT_OBJECT_DIRECTORY ($GIT_DIR/objects),
54 but also the ones found in alternate object pools listed in
55 GIT_ALTERNATE_OBJECT_DIRECTORIES or
56 $GIT_DIR/objects/info/alternates, and in packed Git archives found
57 in $GIT_DIR/objects/pack and corresponding pack subdirectories in
58 alternate object pools. This is now default; you can turn it off
59 with --no-full.
60
61 --connectivity-only
62 Check only the connectivity of tags, commits and tree objects. By
63 avoiding to unpack blobs, this speeds up the operation, at the
64 expense of missing corrupt objects or other problematic issues.
65
66 --strict
67 Enable more strict checking, namely to catch a file mode recorded
68 with g+w bit set, which was created by older versions of Git.
69 Existing repositories, including the Linux kernel, Git itself, and
70 sparse repository have old objects that triggers this check, but it
71 is recommended to check new projects with this flag.
72
73 --verbose
74 Be chatty.
75
76 --lost-found
77 Write dangling objects into .git/lost-found/commit/ or
78 .git/lost-found/other/, depending on type. If the object is a blob,
79 the contents are written into the file, rather than its object
80 name.
81
82 --name-objects
83 When displaying names of reachable objects, in addition to the
84 SHA-1 also display a name that describes how they are reachable,
85 compatible with git-rev-parse(1), e.g.
86 HEAD@{1234567890}~25^2:src/.
87
88 --[no-]progress
89 Progress status is reported on the standard error stream by default
90 when it is attached to a terminal, unless --no-progress or
91 --verbose is specified. --progress forces progress status even if
92 the standard error stream is not directed to a terminal.
93
95 git-fsck tests SHA-1 and general object sanity, and it does full
96 tracking of the resulting reachability and everything else. It prints
97 out any corruption it finds (missing or bad objects), and if you use
98 the --unreachable flag it will also print out objects that exist but
99 that aren’t reachable from any of the specified head nodes (or the
100 default set, as mentioned above).
101
102 Any corrupt objects you will have to find in backups or other archives
103 (i.e., you can just remove them and do an rsync with some other site in
104 the hopes that somebody else has the object you have corrupted).
105
106 If core.commitGraph is true, the commit-graph file will also be
107 inspected using git commit-graph verify. See git-commit-graph(1).
108
110 expect dangling commits - potential heads - due to lack of head
111 information
112 You haven’t specified any nodes as heads so it won’t be possible to
113 differentiate between un-parented commits and root nodes.
114
115 missing sha1 directory <dir>
116 The directory holding the sha1 objects is missing.
117
118 unreachable <type> <object>
119 The <type> object <object>, isn’t actually referred to directly or
120 indirectly in any of the trees or commits seen. This can mean that
121 there’s another root node that you’re not specifying or that the
122 tree is corrupt. If you haven’t missed a root node then you might
123 as well delete unreachable nodes since they can’t be used.
124
125 missing <type> <object>
126 The <type> object <object>, is referred to but isn’t present in the
127 database.
128
129 dangling <type> <object>
130 The <type> object <object>, is present in the database but never
131 directly used. A dangling commit could be a root node.
132
133 sha1 mismatch <object>
134 The database has an object who’s sha1 doesn’t match the database
135 value. This indicates a serious data integrity problem.
136
138 GIT_OBJECT_DIRECTORY
139 used to specify the object database root (usually $GIT_DIR/objects)
140
141 GIT_INDEX_FILE
142 used to specify the index file of the index
143
144 GIT_ALTERNATE_OBJECT_DIRECTORIES
145 used to specify additional object database roots (usually unset)
146
148 Part of the git(1) suite
149
150
151
152Git 2.20.1 12/15/2018 GIT-FSCK(1)