How to git bundle a complete repo
Solution 1:
What is the right invocation to:
- Bundle all the branches in the current repo
Simple:
$ git bundle create repo.bundle --all
Here repo.bundle
is the name of bundle file you want to create. Note that --all
would not include remote-tracking branches... just like ordinary clone wouldn't either.
- Start up the new repo on the destination directory, i.e. get the root commit correctly installed
First, clone
is just init
+ fetch
(+ administrativia).
Second, you can use bundle file everywhere the repository URL can be used, so you can simply clone
from a bundle file:
$ git clone repo.bundle
This would create repo
as a git repository.
Solution 2:
First clone the repository, and include the --mirror
option.
git clone --mirror [email protected]:path/repo.git
This ensures all remote branched are also local branches ready for bundeling.
Then run
git bundle create repo.bundle --all
as described by the answer from Jakub Narębski