Home Explore Blog CI



git

4th chunk of `Documentation/git-bundle.adoc`
c0101515144e5acf596ccb6c89781e39b7727f32d75594b10000000100000913

include refs and commits reachable from those refs.  You will not
include other local state, such as the contents of the index, working
tree, the stash, per-repository configuration, hooks, etc.

You can later recover that repository by using for example
linkgit:git-clone[1]:

----------------
$ git clone backup.bundle <new directory>
----------------

For the next 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 prerequisites. 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/*
------------------------

To update the resulting mine.git repository, you can fetch or pull after
replacing the bundle stored at /home/me/tmp/file.bundle with incremental
updates.

After working some more in the original repository, you can create an
incremental bundle to update the other repository:

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

You then transfer the bundle to the other machine to replace
/home/me/tmp/file.bundle, and pull from it.

----------------
machineB$ cd R2
machineB$ git pull
----------------

If

Title: Transferring Git Repository History Between Machines
Summary
Git bundles can be used to transfer repository history between machines without a direct connection. A bundle can be created on the source machine, transferred to the target machine, and used to bootstrap a new repository. Incremental bundles can then be created and transferred to update the target repository. This process involves creating a bundle with no prerequisites, cloning from it, and then fetching or pulling from incremental updates to keep the target repository up-to-date.