Git repository recovery

A corrupt Git repository may be reconstructed from clones, remotes, packfiles, reflogs, worktrees, and surviving objects.

Git content is stored as objects connected by trees, commits, tags, refs, and reflogs. Hardware errors or interrupted writes can damage loose objects, packfiles, indexes, or refs while working-tree files remain present.

Understand the symptom

git fsck identifies missing, bad, unreachable, and dangling objects but does not recreate absent content.

WHY

What is happening

Git verifies object hashes and reachability through refs and reflogs. Official guidance notes that corrupt objects must be sourced from backups or another repository, while dangling objects and reflogs may retain lost commits if pruning has not removed them.

What you may see

Symptoms that change the recovery path.

01

Missing blob, tree, or commit

A referenced object is absent from loose or packed storage.

02

Object file is empty or corrupt

Disk or filesystem damage may have altered the stored object.

03

Invalid pack index

A packfile and its index may not agree.

04

Branch disappeared

The commit may remain in reflogs, dangling objects, another clone, or CI cache.

Protect the source

Actions that can make the situation worse.

01

git gc can remove dangling evidence

Freeze maintenance and pruning.

02

Fresh clone omits unpushed work

Preserve the damaged worktree and repository first.

03

Copying one object may mask wider storage failure

Assess the disk and verify the complete repository.

Do this now

Safe steps before evaluation.

01

Copy every repository source

Keep .git, worktree, submodules, alternates, bare remotes, bundles, and clones.

02

Record fsck output

Run read-only checks on a duplicate and preserve missing-object IDs.

03

Freeze automated maintenance

Stop gc, prune, repack, fetch cleanup, and CI cache rotation.

04

Protect failing storage

Image the device before scanning many packfiles.

NEPFOSYS process

How a data-first evaluation proceeds.

01

Object-graph inventory

NEPFOSYS maps refs, reflogs, loose objects, packs, alternates, and available clones.

02

Object reconstruction

Matching objects are sourced from authorized copies or surviving data and inserted into a working duplicate.

03

Repository validation

fsck, branches, tags, histories, submodules, worktrees, and priority files are checked.

A clear next step

Preserve the original device before another repair or recovery attempt.

Start a case with the exact symptoms, incident timeline, prior attempts, encryption details, and the files that matter most. NEPFOSYS will route the case to the appropriate DFW intake or nationwide mail-in path.

Start with a case review

Questions, answered

What customers ask before starting.

Can git fsck repair missing objects?

It identifies problems; missing content must come from another copy, backup, pack, or recoverable storage.

Should I run git prune?

No. Prune can delete dangling objects that may contain lost work.

Is a fresh clone enough?

Only for pushed content. Preserve local commits, changes, reflogs, submodules, and LFS data from the affected system.

DFW local · Nationwide mail-in

Protect the device. Start with the facts.

Start my recovery case