Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unbundle a git bundle?

I just received a Git bundle via email. How do I unbundle it in order to read it? I am having trouble using the unbundle command. I have tried

git unbundle *bundle name* 

but that gives me just a weird code

eae0b00697e53cd87c871143051673f3ee413148  

and refs/heads/master

like image 296
James Hennessy Avatar asked Mar 16 '17 16:03

James Hennessy


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.

What is git bundle command?

Bundles are used for the "offline" transfer of Git objects without an active "server" sitting on the other side of the network connection. They can be used to create both incremental and full backups of a repository, and to relay the state of the references in one repository to another.

Does git bundle include tags?

git bundle will only package references that are shown by git show-ref: this includes heads, tags, and remote heads. References such as master~1 cannot be packaged, but are perfectly suitable for defining the basis. More than one reference may be packaged, and more than one basis can be specified.


1 Answers

I am having trouble using the unbundle command.

You are not supposed to run this command at all.

I just received a Git bundle via email. How do I unbundle it in order to read it?

This is described in the git bundle documentation:

EXAMPLE

Assume you want to transfer the history from a repository R1 on machine A to another repository R2 on machine B. For whatever reason, direct connection between A and B is not allowed, but we can move data from A to B via some mechanism (CD, email, etc.). We want to update R2 with development made on the branch master in R1.

To bootstrap the process, you can first create a bundle that does not have any basis. You can use a tag to remember up to what commit you last processed, in order to make it easy to later update the other repository with an incremental bundle:

machineA$ cd R1
machineA$ git bundle create file.bundle master
machineA$ git tag -f lastR2bundle master

Then you transfer file.bundle to the target machine B. Because this bundle does not require any existing object to be extracted, you can create a new repository on machine B by cloning from it:

machineB$ git clone -b master /home/me/tmp/file.bundle R2

This will define a remote called "origin" in the resulting repository that lets you fetch and pull from the bundle. The $GIT_DIR/config file in R2 will have an entry like this:

[remote "origin"]
    url = /home/me/tmp/file.bundle
    fetch = refs/heads/*:refs/remotes/origin/*

See the rest of the documentation for the rest of the instructions. Note that you are "machine B" in this example; someone else, on machine A, has done the first few steps. (Did they do them correctly? I don't know; do you?)

like image 137
torek Avatar answered Nov 14 '22 22:11

torek