I have a Git repository, and a mirror of it in another environment which is not connected to the internet and has no network access.
Still, I need to keep a consistent view of the original copy in the offline environment.
In order to do this, I copy the entire repository from the online environment (via DOK) into the offline one. Then I pull from this copy into the offline repository.
This process is very cumbersome since the repository is huge (20 GB), and the copy requires me several virus scans and several copies from disk to disk.
My question is if there is a way to copy only the new commits (similar to what is sent during a push), in order to reduce the overhead of this synchronization?
This is one reason the
git bundle command exists. You can pack up ranges of commits into a single bundle file. Example, assuming you've already got commit
abc123 in the offline environment and you want to pack up everything that happened after that on
master (you can include as many branches/tags as you want):
git bundle create foo.bundle abc123..master
Then, after copying the file to the offline environment, here's one way to merge one of the branches from the bundle:
# (make sure master is checked out) git fetch foo.bundle master git merge FETCH_HEAD