wit fsck
Thewit fsck (file system check) command verifies the integrity and connectivity of objects in the repository.
Overview
fsck checks for:
- Corrupted objects
- Missing objects
- Dangling objects (unreachable)
- Invalid references
- Connectivity issues
Usage
Output
With Issues
Options
| Option | Description |
|---|---|
--full | Full check including pack files |
--connectivity-only | Only check object connectivity |
--dangling | Report dangling (unreachable) objects |
--unreachable | Show all unreachable objects |
--verbose | Verbose output |
--strict | Strict checking mode |
--lost-found | Write dangling objects to .wit/lost-found/ |
--repair | Attempt to repair issues (use with caution) |
Common Checks
Object Integrity
Verifies each object:- Correct hash matches content
- Valid object format
- Proper compression
Connectivity
Ensures all references are valid:- Commits reference valid trees
- Trees reference valid blobs and trees
- Parent commits exist
References
Validates all refs:- Branches point to valid commits
- Tags point to valid objects
- HEAD is valid
Examples
Quick Check
Find Dangling Objects
Verbose Check
Strict Mode
Recovering Lost Data
From Dangling Objects
From Lost-Found
Repair Mode
Warning: Use --repair with caution. Always backup first.
- Remove references to missing objects
- Rebuild broken links where possible
- Clean up corrupted partial objects
When to Use
After System Crash
After Disk Errors
Periodic Maintenance
Before Important Operations
Comparison with Git
| Feature | wit fsck | git fsck |
|---|---|---|
| Object verification | Yes | Yes |
| Connectivity check | Yes | Yes |
| Dangling detection | Yes | Yes |
| Lost-found recovery | Yes | Yes |
| Repair mode | Yes | No (manual) |
| Progress output | Yes | Minimal |
Related
- wit gc - Garbage collection
- wit reflog - Reference history
- wit cat-file - Inspect objects