How to do it...

  1. Let's look for the unreachable objects in the database:
$ git fsck --unreachable 

Checking object directories: 100% (256/256), done. 
unreachable commit 147240ad0297f85c9ca3ed513906d4b75209e83d 
unreachable blob b16cf63ab66605f9505c17c5affd88b34c9150ce 
unreachable commit 4c3b1e10d8876cd507bcf2072c85cc474f7fb93b 
The object's ID, the SHA-1 hash, will not be the same if you perform the example on your computer, as the committer, author, and timestamp will be different.
  1. We found two commits and one blob. Let's take a closer look at each of them; the blob first:
$ git show b16cf63ab66605f9505c17c5affd88b34c9150ce 

#include <stdio.h> 
void say_hello(void) { 
  printf("hello, worldn"); 
} 
 
int main(void){ 
  say_hello(); 
   return 0; 
}

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.