Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/git-fsck.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / git-fsck.adoc` 189 lines ยท 6134 bytes Raw Blame History 1 git-fsck(1) 2 =========== 3 4 NAME 5 ---- 6 git-fsck - Verifies the connectivity and validity of the objects in the database 7 8 9 SYNOPSIS 10 -------- 11 [verse] 12 'git fsck' [--tags] [--root] [--unreachable] [--cache] [--no-reflogs] 13 [--[no-]full] [--strict] [--verbose] [--lost-found] 14 [--[no-]dangling] [--[no-]progress] [--connectivity-only] 15 [--[no-]name-objects] [--[no-]references] [...] 16 17 DESCRIPTION 18 ----------- 19 Verifies the connectivity and validity of the objects in the database. 20 21 OPTIONS 22 ------- 23 :: 24 An object to treat as the head of an unreachability trace. 25 + 26 If no objects are given, 'git fsck' defaults to using the 27 index file, all SHA-1 references in the `refs` namespace, and all reflogs 28 (unless --no-reflogs is given) as heads. 29 30 --unreachable:: 31 Print out objects that exist but that aren't reachable from any 32 of the reference nodes. 33 34 --dangling:: 35 --no-dangling:: 36 Print objects that exist but that are never 'directly' used (default). 37 `--no-dangling` can be used to omit this information from the output. 38 39 --root:: 40 Report root nodes. 41 42 --tags:: 43 Report tags. 44 45 --cache:: 46 Consider any object recorded in the index also as a head node for 47 an unreachability trace. 48 49 --no-reflogs:: 50 Do not consider commits that are referenced only by an 51 entry in a reflog to be reachable. This option is meant 52 only to search for commits that used to be in a ref, but 53 now aren't, but are still in that corresponding reflog. 54 55 --full:: 56 Check not just objects in GIT_OBJECT_DIRECTORY 57 ($GIT_DIR/objects), but also the ones found in alternate 58 object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES 59 or $GIT_DIR/objects/info/alternates, 60 and in packed Git archives found in $GIT_DIR/objects/pack 61 and corresponding pack subdirectories in alternate 62 object pools. This is now default; you can turn it off 63 with --no-full. 64 65 --connectivity-only:: 66 Check only the connectivity of reachable objects, making sure 67 that any objects referenced by a reachable tag, commit, or tree 68 are present. This speeds up the operation by avoiding reading 69 blobs entirely (though it does still check that referenced blobs 70 exist). This will detect corruption in commits and trees, but 71 not do any semantic checks (e.g., for format errors). Corruption 72 in blob objects will not be detected at all. 73 + 74 Unreachable tags, commits, and trees will also be accessed to find the 75 tips of dangling segments of history. Use `--no-dangling` if you don't 76 care about this output and want to speed it up further. 77 78 --strict:: 79 Enable more strict checking, namely to catch a file mode 80 recorded with g+w bit set, which was created by older 81 versions of Git. Existing repositories, including the 82 Linux kernel, Git itself, and sparse repository have old 83 objects that trigger this check, but it is recommended 84 to check new projects with this flag. 85 86 --verbose:: 87 Be chatty. 88 89 --lost-found:: 90 Write dangling objects into .git/lost-found/commit/ or 91 .git/lost-found/other/, depending on type. If the object is 92 a blob, the contents are written into the file, rather than 93 its object name. 94 95 --name-objects:: 96 When displaying names of reachable objects, in addition to the 97 SHA-1 also display a name that describes *how* they are reachable, 98 compatible with linkgit:git-rev-parse[1], e.g. 99 `HEAD@{`1234567890`}~25^2:src/`. 100 101 --progress:: 102 --no-progress:: 103 Progress status is reported on the standard error stream by 104 default when it is attached to a terminal, unless 105 --no-progress or --verbose is specified. --progress forces 106 progress status even if the standard error stream is not 107 directed to a terminal. 108 109 --references:: 110 --no-references:: 111 Control whether to check the references database consistency 112 via 'git refs verify'. See linkgit:git-refs[1] for details. 113 The default is to check the references database. 114 115 CONFIGURATION 116 ------------- 117 118 include::includes/cmd-config-section-all.adoc[] 119 120 include::config/fsck.adoc[] 121 122 DISCUSSION 123 ---------- 124 125 git-fsck tests SHA-1 and general object sanity, and it does full tracking 126 of the resulting reachability and everything else. It prints out any 127 corruption it finds (missing or bad objects), and if you use the 128 `--unreachable` flag it will also print out objects that exist but that 129 aren't reachable from any of the specified head nodes (or the default 130 set, as mentioned above). 131 132 Any corrupt objects you will have to find in backups or other archives 133 (i.e., you can just remove them and do an 'rsync' with some other site in 134 the hopes that somebody else has the object you have corrupted). 135 136 If core.commitGraph is true, the commit-graph file will also be inspected 137 using 'git commit-graph verify'. See linkgit:git-commit-graph[1]. 138 139 Extracted Diagnostics 140 --------------------- 141 142 unreachable :: 143 The object , isn't actually referred to directly 144 or indirectly in any of the trees or commits seen. This can 145 mean that there's another root node that you're not specifying 146 or that the tree is corrupt. If you haven't missed a root node 147 then you might as well delete unreachable nodes since they 148 can't be used. 149 150 missing :: 151 The object , is referred to but isn't present in 152 the database. 153 154 dangling :: 155 The object , is present in the database but never 156 'directly' used. A dangling commit could be a root node. 157 158 hash mismatch :: 159 The database has an object whose hash doesn't match the 160 object database value. 161 This indicates a serious data integrity problem. 162 163 164 FSCK MESSAGES 165 ------------- 166 167 The following lists the types of errors `git fsck` detects and what 168 each error means, with their default severity. The severity of the 169 error, other than those that are marked as "(FATAL)", can be tweaked 170 by setting the corresponding `fsck.` configuration variable. 171 172 include::fsck-msgids.adoc[] 173 174 175 Environment Variables 176 --------------------- 177 178 GIT_OBJECT_DIRECTORY:: 179 used to specify the object database root (usually $GIT_DIR/objects) 180 181 GIT_INDEX_FILE:: 182 used to specify the index file of the index 183 184 GIT_ALTERNATE_OBJECT_DIRECTORIES:: 185 used to specify additional object database roots (usually unset) 186 187 GIT 188 --- 189 Part of the linkgit:git[1] suite