http://blog.wikimedia.org/2012/09/07/recovery-of-broken-gerrit-repositories/ writes:
While Git does make it very difficult to get rid of data forever, it is possible. For example, if we had let the cron run again, git gc would’ve merrily deleted all of the unreferenced objects since they were unused.
So, now it just became a matter of sorting out which refs these commits could go to. Playing around with git show makes it pretty easy to figure out where the commits belong, and so this just turned into a process of editing the appropriate refs/* files to add the commit hash (and what seems so obvious now took several hours of hand-wringing, I assure you). So for the next several hours, I took the time to sort out these dangling commits, and the repos ended up working again.
Doesn't formey have core.logAllRefUpdates set to true? Wouldn't that have prevented git gc from removing commits referenced in the reflog? (at least until two weeks without the references passed, it should probably have been run with --no-prune)