Questions tagged [git-fsck]

A git command line tool that verifies the connectivity and validity of the objects in the database

git-fsck tests SHA-1 and general object sanity, and it does full tracking of the resulting reachability and everything else. It prints out any corruption it finds (missing or bad objects), and if you use the --unreachable flag it will also print out objects that exist but that aren't reachable from any of the specified head nodes (or the default set, as mentioned above).

Resources:

34 questions
232
votes
5 answers

What is a dangling commit and a blob in a Git repository and where do they come from?

I'm looking for the basic information on dangling commits and blobs. My repository seems fine. But I ran git fsck for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'. What are these things?…
doub1ejack
  • 10,627
  • 20
  • 66
  • 125
66
votes
2 answers

What does git fsck stand for?

What is the meaning in behind the fsck command name? The documentation of the command does not seem to mention what the name stands for.
Maic López Sáenz
  • 10,385
  • 4
  • 44
  • 57
21
votes
4 answers

How to resolve Git reporting invalid sha1 pointer 0000000000000000000000000000000000000000?

My computer shut down suddenly and now the Git repository of the project which I worked on is defect. I have Git 2.20.1 installed. I immediately created a backup copy of the project folder to play around with the original. I have local branches…
JJD
  • 50,076
  • 60
  • 203
  • 339
18
votes
1 answer

What are the dos and don'ts of custom objects and refs?

Let's say I want to write a small helper that allows to append some metadata to a repository in a way that can propagate to clones via refs. Simple example (a git-notes clone prototype that doesn't even attach the notes to any other git…
Tobias Kienzler
  • 25,759
  • 22
  • 127
  • 221
16
votes
2 answers

Recover staged but not committed files after 'git rm -rf'

On my local machine I removed files from folder. git init git add --all then I wrote (don't ask me, why! :) ) git rm -rf I don't commit, yet. Now I have empty folders in my project. In .git folder has objects with 53 Mb of files. How can I…
user2003024
  • 191
  • 1
  • 8
12
votes
3 answers

Ignore fsck / zero-padded file mode errors in "git clone"

I have the following settings in my global Git configuration: [transfer] fsckobjects = true [fetch] fsckobjects = true [receive] fsckobjects = true These verify that all objects in the cloned database are valid and reachable. However,…
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
7
votes
1 answer

Are "dangling" and "loose" objects the same?

Git's fsck doc talks about "dangling" objects, while the gc doc talks only about "loose objects". There's a strict split. But while skimming a few related SO posts, the terms seem to be used interchangeably. In the Git Book v2 and Git's source code…
Katrin Leinweber
  • 1,316
  • 13
  • 33
6
votes
1 answer

How to fix corrupted git repository - "git fsck" reports "warning in tree [hash]: contains entries pointing to null sha1"

Overview: I am unable to successfully pull changes in our repo to our production server. Running "git fsck" on my repo returned 5 instances of the same error: warning in tree [hash]: contains entries pointing to a null sha1 The error exists on all…
Blaine Osepchuk
  • 1,067
  • 1
  • 9
  • 17
5
votes
2 answers

How can I fix "bad date" issues in a git repository?

I recently tried to import a repository into GitHub (from Bitbucket) and the import was failing. GitHub tech support imformed me that they were seeing "bad date" issues in the repository and that I should run git fsck on the repository. So I cloned…
Tim Long
  • 13,508
  • 19
  • 79
  • 147
5
votes
2 answers

How can I recover HEAD^'S tree?

tl;dr: is it possible to recover HEAD^'s tree if it is deleted and not pushed beforehand and if everything else is intact? I accidentally deleted part of my .git. I'm not entirely sure what's missing. Upon discovering that git push didn't work, I…
strugee
  • 2,752
  • 4
  • 19
  • 30
4
votes
1 answer

How can I recover from "invalid sha1 pointer in resolve-undo" with git fsck?

I run git gc in a repository and get a fatal error: Enumerating objects: 2382, done. Counting objects: 100% (2382/2382), done. Delta compression using up to 8 threads Compressing objects: 100% (747/747), done. fatal: unable to read…
Joe
  • 29,416
  • 12
  • 68
  • 88
4
votes
1 answer

Git - remove missing blobs or trees

Is there a way to remove references to a missing blob or tree from the history? Here is the output of git fsck --full broken link from tree 99fe1a9d46985ca21e88de53a7a290e2b1889722 to blob…
Ole
  • 107
  • 3
  • 7
3
votes
1 answer

How do I use git-filter-repo to fix a bad date

I have a git repo that was converted from RCS via CVS many years ago. When I tried to push it to GitHub it was rejected because the initial two commits had bad dates: $ git fsck Checking object directories: 100% (256/256), done. error in commit…
3
votes
1 answer

git fsck combining --lost-found and --unreachable

I found many interesting posts about git fsck, so I wanted to experiment a little on them. First of all the sources I read before this question: How can I find an unreachable commit hash in a GIT repository by keywords? git fsck: how --dangling…
Marco Luzzara
  • 5,540
  • 3
  • 16
  • 42
3
votes
1 answer

How to check a Mercurial repository for consistency (checksums)?

Assume I recover a Mercurial repository from a broken file system (e.g. bad hard drive), and I want to be sure that this one was not affected. How can I force a self-check in Mercurial? That is, Mercurial walks through the whole history and checks…
vog
  • 23,517
  • 11
  • 59
  • 75
1
2 3