gitdata-recoveryfsck

Git fsck for specific folder


Is it possible to run

git fsck

For a specific folder when I am sure that the files I have deleted were located under a specific folder in my Mac?


Solution

  • Git doesn't delete the objects, it just removed the reference to it.

    The git-fsck command verifies the connectivity and validity of the objects in the database.

    You can execute the git-fsck command on the repository. With the --unreachable argument, it will show you the objects that are unreachable i.e unreachable commit , unreachable blob, etc.. After that, you can also use the git-show command to see each object. Once you have found which one corresponds to the files you have deleted, you can run git-stash apply *commit ID* to apply the commit to your master branch again.