Course Tonight

Course Tonight

Did You Know?

Docy turns out that context is a key part of learning.

Chapter 39: Bundles

Estimated reading: 2 minutes 4 views

Section 39.1: Creating a git bundle on the local machine and using it on another

Sometimes, you may need to maintain versions of a Git repository on machines without a network connection. Bundles allow you to package Git objects and references from one machine’s repository and import them into another.

On the local machine, follow these steps:

  1. Create a tag to mark a specific version:
git tag 2016_07_24

Create a bundle file that captures the changes between a previous tag and the newly created tag:

git bundle create changes_between_tags.bundle [some_previous_tag]..2016_07_24

Transfer the changes_between_tags.bundle file to the remote machine, for example, via a thumb drive. Once it’s on the remote machine, perform the following steps:

  1. Verify the integrity of the bundle file:
git bundle verify changes_between_tags.bundle

Checkout the desired branch in the remote repository:

git checkout [some branch]

List the references in the bundle:

git bundle list-heads changes_between_tags.bundle

Pull the changes from the bundle into the remote repository using a specific reference from the bundle:

git pull changes_between_tags.bundle 
    
        
            [1]
        
        
    

	

The reverse process is also possible. If you make changes in the remote repository, you can bundle the deltas, transfer the changes (e.g., via a thumb drive), and merge them back into the local repository. This allows both repositories to stay in sync without requiring direct Git, SSH, Rsync, or HTTP protocol access between the machines.

Leave a Comment

Share this Doc

Chapter 39: Bundles

Or copy link

CONTENTS