From: Clemens Buchacher Date: Mon, 25 Jul 2011 22:34:50 GMT Subject: Re: Is there a quick way to identify commits that reference missing trees or blobs? Message-ID: <20110725223449.GA25560@toss.lan> In-Reply-To: On Sun, Jul 24, 2011 at 02:48:20AM +1000, Jon Seymour wrote: > > I was wondering if there is a quick way to identify commits that > reference missing trees or blobs as identified by git fsck? The following command has served me well for this purpose. I apply it to each ref in git-for-each-ref: $ git rev-list --objects $ref | git cat-file --batch-check It may not be the fastest way to do it, but it did the trick for me. I then simply deleted any broken refs using git update-ref -d $ref, even if the tip of the branch was still intact. I could have tried to salvage some history from those refs, but I had a backup and at that point I just wanted to continue working. hth, Clemens