I need to transfer a complete repo to a new non-networked machine, preferable as a single file entity. The git bundle allows a git fetch, git pull style operation in a sneakernet environment but appears to assume that you already have a working version of the repo on the destination machine.
What is the right invocation to:
- Bundle all the branches in the current repo
- Start up the new repo on the destination directory, i.e. get the root commit correctly installed
I’ve sent a patch upstream to clarify:
`git clone` can use any bundle created without negative refspecs
(e.g., `new`, but not `old..new`).
If you want to match `git clone --mirror`, which would clone other
refs such as `refs/remotes/*`, use `--all`.
If you want to provide the same set of refs that a clone directly
from the source repository would get, use `--branches --tags` for
the `<git-rev-list-args>`.
So $ git bundle create repo.bundle --branches --tags best matches cloning.
$ git bundle create repo.bundle --all will provide a mirror image of your source machine, including its remote refs.
Simple:
Here
repo.bundleis the name of bundle file you want to create. Note that--allwould not include remote-tracking branches… just like ordinary clone wouldn’t either.First,
cloneis justinit+fetch(+ administrativia).Second, you can use bundle file everywhere the repository URL can be used, so you can simply
clonefrom a bundle file:This would create
repoas a git repository.