git fsck
- Git course
- Expert
- Lesson 19/32
- 4 min
Learn repository validation with git fsck.
Repository verification with git fsck
git fsck checks the integrity of objects in a Git repository. It helps inspect object connections, contents, and possible problems in the repository structure.
git fsckIt is useful when repository corruption is suspected or when you want to verify the repository after maintenance.
Fsck check options
The git fsck command can perform more comprehensive checks with different options. --full performs a broader object check. --no-reflogs excludes reflog entries when evaluating reachability.
git fsck --full
git fsck --no-reflogsThe output may contain information about corrupt objects, missing links, or unreachable objects.
Practice Check repository integrity
Perform a full integrity check on the Git repository. Then print a message indicating that the check is complete.
Starter code
# Kapsamlı depo kontrolünü çalıştır
# Kontrol mesajını yazdırSample solution
git fsck --full
echo 'Depo bütünlüğü kontrol edildi'Expected output
Depo bütünlüğü kontrol edildi
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command should you run to check the integrity and connectivity of repository objects?
- git prune
- git fsck Correct answer
- git gc
- git show
Explanation: <code>git fsck</code> checks the integrity and connectivity of Git objects.
2 Complete the full verification option
git fsck ____
git fsck --full
Explanation: <code>--full</code> enables a more comprehensive fsck check of repository objects.
3 Fsck verification concepts
| Term | Meaning |
|---|---|
git fsck |
Checks repository integrity |
Integrity |
Consistency of data |
Connectivity |
Connections between objects |
--full |
Performs a full object check |