A Git dump file is restored by treating it as what it actually is — a serialized snapshot of a repository's objects and references — and replaying that content into a real Git repository, most commonly with git clone if the file is a bundle, or by unpacking and feeding the raw content into Git's object database if it is a custom or historical dump. The answer depends heavily on which kind of "dump" you have, because Git has no single canonical "dump" format. The word is used for at least three different things: a Git bundle (.bundle), a repository archive produced by tools like git fast-export or git archive, and a raw object dump made by scripts that concatenate loose objects, pack files, or git cat-file output. Restoring each one requires a different procedure, and mixing them up is the most common reason people find their "dump" seemingly unreadable.

The advice below assumes you have the file in hand and a working Git installation (Git 2.x or newer). It does not assume you still have the original server, the original working directory, or network access to any remote — restoration from a dump is precisely the scenario where those are gone.

First, identify what kind of file you actually have

Before running any command, inspect the file. On Linux or macOS, file yourfile.dump and head -c 200 yourfile.dump will usually settle the question in seconds. On Windows, open it in a text editor or use Get-Content -TotalCount 5.

Symptom Likely format Restore strategy
Starts with # v2 git bundle or # v3 git bundle Git bundle git clone or git fetch from the file
File name ends in .bundle, .bdl Git bundle Same as above
Readable text beginning with commit refs/heads/... and containing blob, data, reset lines git fast-export stream git fast-import into a new repo
A .tar, .tar.gz, .zip containing a working tree (files, no .git) git archive output Extract, then git init and re-commit (no history)
A .tar/.zip/directory containing objects/, refs/, HEAD, config A bare or full .git directory dump Point Git at it directly, or clone from it
Binary blob with a PACK header, or a single file starting with PACK A bare pack file Index and unpack into a repo's objects/pack
Text like tree , parent , author ... git cat-file output or hand-built object dump Rebuild via git hash-object -w or git fast-import

The critical distinction is between formats that carry full repository history (bundles, fast-export streams, .git directory copies) and formats that carry only a snapshot of files (archive tarballs, git archive output). An archive cannot give you back commit history, branches, tags, or author dates — it only reproduces the tree at one point. If a colleague says "I dumped the repo" and hands you a .tar.gz, verify whether it contains a .git directory before assuming history is recoverable.

Restoring a Git bundle

A Git bundle is the most common meaning of "Git dump file," and it is also the easiest to restore, because Git itself can read it as a remote. A bundle is a single file that packages a set of refs and the objects reachable from them, exactly as a fetch would transfer them. It is the format git bundle create produces and the format most backup scripts use.

The direct restore is:

Git treats the bundle file as a remote URL. git clone will create a new directory, copy the objects, set up the default branch, and check out the working tree. If the bundle was created with a single branch (for example git bundle create backup.bundle main), the clone will contain that branch; other refs will not exist because they were not included at creation time. That is a property of the dump, not a bug in the restore.

If you already have a repository and want to pull the bundle's contents into it rather than clone fresh:

After fetching, the bundle's branches appear under bundle/ (for example bundle/main), and you merge or rebase them as you would any remote. Once you are satisfied, git remote remove bundle cleans up the temporary remote. If the bundle is "thin" — created with --thin or by packaging a range that excludes some base objects — a plain clone can fail with "cannot read bundle" or "missing object." Thin bundles are only usable against a repository that already contains the excluded objects, so the fix is to fetch them into the correct repository rather than clone from scratch.

A common error is trying git bundle unbundle or git clone on a bundle that was created with --all but contains a detached HEAD only. If git clone reports that no branch was found, list what the bundle contains with git bundle list-heads repo.bundle and then fetch specific refs into a new empty repo:

That sequence restores every branch the bundle carries even when the clone heuristic fails.

Restoring a git fast-export stream

git fast-export produces a textual, deterministic stream of commits, blobs, tags, and resets. It is often used for migrations, for filtering history, or as a human-readable backup, and people frequently save its output to a file called something like dump.txt or repo.dump. To restore it, use git fast-import, which is the exact inverse.

Three details matter. First, fast-import writes into the current repository's object database, so you must run it inside an initialized repository, not in an arbitrary directory. Second, the stream may define branches that are not your default; after import, run git branch -a and check out the branch you want. Third, fast-import does not delete existing objects, so importing into a non-empty repo will merge histories rather than replace them. If you want a clean restore, always import into a fresh repository.

If fast-import reports "Not a valid fast-import stream" or stops partway, the file is probably truncated — a partial copy, an interrupted download, or a dump that was cut off by a disk quota. fast-import is largely line-oriented and will often fail at the exact point of truncation, which at least tells you whether the damage is at the end. There is no general repair for a truncated textual dump beyond recovering a complete copy; the history it does contain up to the cut can sometimes be salvaged by deleting the incomplete trailing commit block, but that is a manual, error-prone edit and should be done on a copy.

Restoring a raw object dump or pack file

Some scripts "dump" a repository by copying its .git directory, by concatenating loose objects, or by saving a single pack file. These are not portable formats in the way a bundle is, but they are recoverable because Git objects are self-identifying.

If you have a directory containing objects/, refs/, and HEAD — in other words, a copied .git directory — the fastest restore is to make it a repository Git can use directly:

If the copy is a bare repository (no working tree), clone from it locally:

If you have a single pack file (pack-*.pack plus its .idx, or just a .pack), you can place it in a repository's objects/pack/ directory and let Git index it. Git will normally refuse to work with an unindexed pack, so generate the index first:

Then move both the .pack and the resulting .idx into restored-repo/.git/objects/pack/. Git will discover the objects the next time it needs them, but it will not know which commits are branch tips unless you have the refs. If you also have a refs/ tree or a packed-refs file, copy it in; otherwise use git fsck --lost-found to list dangling commits and recover them manually with git branch recovered . This is the slow, archaeology-style restore, and it is the last resort when the only surviving artifact is a pack.

Loose objects can be handled similarly: copy the two-character subdirectories of objects/ into the new repository's objects/ directory, then run git fsck --lost-found. Loose objects are content-addressed, so they are self-verifying; if fsck complains about a specific object, that one is corrupt and the rest are likely usable.

Restoring from a working-tree archive

If the dump is a .tar.gz or .zip produced by git archive or by a plain directory compression, you do not have Git history — you have files. Extract them and re-initialize:

This produces a repository with a single commit. It will not reconnect to the original history, will not carry original author dates, and will not have branches or tags. If your goal is to resume development from that snapshot, this is adequate. If your goal is to preserve history, you need a different source: look for an accompanying .bundle, a bare repo copy, or a remote that still exists. It is worth checking whether the archive actually contains a .git directory before concluding that history is lost — archives made by copying a working directory with tar sometimes include it by accident, and in that case treat it as a .git directory dump (see above).

Why "dump" is ambiguous, and what that means for recovery

Git deliberately does not ship a single backup command. Its design philosophy is that the repository is a content-addressed object store plus refs, and any faithful copy of that store is a valid backup. As a result, the ecosystem has settled on several conventions, each with different fidelity:

Bundles preserve refs and history, are single-file and portable, and can be verified with git bundle verify. They are the closest thing to an official dump format. Fast-export streams preserve history in a human-readable form and are excellent for migration and auditing, but they require fast-import to restore and are more sensitive to truncation. .git directory copies and pack files preserve everything bit-for-bit but are not portable across tools without Git itself doing the interpretation. Working-tree archives preserve only a snapshot and are not a backup in the version-control sense.

Knowing which one you have determines what is recoverable. A bundle that contains only main cannot restore a deleted feature branch, because that branch was never in the dump. A pack file without refs can restore commits but not the labels that made them easy to find. A tarball of files can restore the code but not the history. These are limitations of the dump, not of the restore procedure, and no amount of clever Git usage will recover information that was never written down.

Verifying the restore before you trust it

Whatever route you use, verify three things. First, that git fsck --full reports no missing or corrupt objects. Second, that git log --oneline shows the commits you expect, including the tip you care about — compare against any record you have, such as the output of git log from the original machine. Third, that git status on the default branch is clean and that the working tree matches the last commit; an incomplete checkout after a bundle clone is a sign that some objects were missing.

For bundles specifically, git bundle verify repo.bundle before cloning tells you whether the file is self-consistent and which refs it requires as prerequisites. A bundle that fails verification is corrupt or incomplete, and re-copying it from the original source is usually faster than attempting repair. For fast-import streams, a successful import followed by git fsck and a commit-count comparison is the practical check; there is no bundle-style verify command for textual streams.

It is also wise to restore into a new directory rather than over the top of any existing repository, and to keep the original dump file untouched until verification passes. Restoration commands that write into a repository (fast-import, unpacking objects, fetching from a bundle) can leave partial state if interrupted, and starting from a clean directory makes it trivial to discard a failed attempt and try again.

Practical summary

Match the restore method to the dump format, not to the file extension. Bundles restore with git clone or git fetch and are the most reliable single-file format. Fast-export streams restore with git fast-import into a fresh repository. .git directory copies and pack files restore by placing them where Git expects objects and letting git fsck recover refs if necessary. Working-tree archives restore only files and must be re-committed, with history permanently lost from that source. In every case, verify with git fsck and a commit-history check before relying on the restored repository, and treat any dump that fails verification as an incomplete copy to be re-obtained rather than a puzzle to be repaired.