snippetjavascriptTip
Find lost files using Git
Viewed 0 times
findgitfileslostusing
Problem
If you've lost files or commits in your Git repository, you can use the
Simply running
git fsck command to find them. This command is useful for recovering lost data or understanding the state of your repository.Simply running
git fsck --lost-found will print a list of all dangling objects (lost files and commits) in your repository. These objects will be extracted into the .git/lost-found directory for further inspection.Solution
# Syntax: git fsck --lost-found
git fsck --lost-found
# dangling commit 3050fc0de
# dangling blob 807e3fa41
# dangling commit 59ff8481dCode Snippets
# Syntax: git fsck --lost-found
git fsck --lost-found
# dangling commit 3050fc0de
# dangling blob 807e3fa41
# dangling commit 59ff8481dContext
From 30-seconds-of-code: find-lost-files
Revisions (0)
No revisions yet.