Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

restoring git repository from bundle backup

i created backups of my git repository like in How to backup a local Git repository? proposed with

git bundle create /tmp/foo-all --all 

I can see all refs are in there, including a remote ref created by git-svn. Now I can't figure out how to restore this bundle to a local repository again. I am quite quite sure i've done it already once. I tried git-clone but that gives me a just a repository with my backup bundle as remote repo.

I also tried

git init git bundle unbundle /tmp/foo --all  

but this just lists all references...

Verifying the bundle gives:

$ git bundle verify $somewhere/foo.bundle  The bundle contains 12 refs xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/master xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/remotes/git-svn xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HEAD The bundle requires these 0 ref $somewhere/foo.bundle is okay 
like image 540
user1283719 Avatar asked Mar 21 '12 15:03

user1283719


People also ask

What is git unbundle?

unbundle <file> Passes the objects in the bundle to git index-pack for storage in the repository, then prints the names of all defined references. If a list of references is given, only references matching those in the list are printed. This command is really plumbing, intended to be called only by git fetch.

How does git bundle work?

A git bundle file is essentially a full repository in a single file. You can have branches, history, tags, basically everything you expect in a repository, but it's all contained in a single file. This makes sharing the repository or moving the full repository pretty straightforward.


2 Answers

Short answer:

$ git bundle verify $somewhere/foo.bundle $ git clone $somewhere/foo.bundle Cloning into 'foo'... Receiving objects: 100% (10133/10133), 82.03 MiB | 74.25 MiB/s, done. Resolving deltas: 100% (5436/5436), done. $ cd foo $ git status ... 

Lazy Badger said this, but it's in the last paragraph. :)

like image 82
fbicknel Avatar answered Sep 19 '22 17:09

fbicknel


I newer version of git is enough to do:

git clone bundle.file 

the whole commands:

mkdir ~/git cd ~/git git clone /path/to/bundle.file 

It will restore completely Your's git bare repository content (which will compile as it is normal source). You don't need any other file. The bundle file is enough.

It is wise to always verify You bundle file before unbundle as follow:

git bundle verify /path/to/bundle.file  
like image 45
masterdany88 Avatar answered Sep 20 '22 17:09

masterdany88