How can I use a Git bundle files to continuously mirror a bare repo?

Viewed 163

I have a bare Git repository on one network that has many branches in it. I would like to periodically flow new commits from that source Git repository to a mirror on another, unconnected network. I can start this process using git bundle:

# Export entire repo to a bundle file on network 1.
git bundle create repo.bundle --all
# Copy bundle file to network 2.
# ...
# On network 2, clone the bundle file to create a new bare repo from it.
git clone --mirror /path/to/repo.bundle

This works! However, I would like to periodically export new commits/branches from network 1 and flow them into the repository mirror in network 2. That is, if I make a new bundle at a later date:

# Time passes.
# Create a new bundle to get the new state of the repo. I could use --since arguments here
# to reduce the bundle size, but I won't do that here for brevity.
git bundle create repo-updated.bundle --all
# Copy bundle file to network 2.
# ...
# On network 2, how do I pull the new commits/branches into the bare repo mirror?

I'm not sure how to "update" the state of the bare repo on network 2 given the new bundle file. I tried git remote update, but this seems to fetch the changes only, and it doesn't actually update any of the branches in the bare repo on network 2. Is there a single command that I can run using the updated bundle file to get the repo on network 2 into the same state as it was on network 1?

0 Answers
Related