Git 在本地计算机上创建一个git bundle并在另一台计算机上使用

示例

有时,您可能希望在没有网络连接的计算机上维护git存储库的版本。捆绑包允许您将git对象和引用打包到一台计算机上的存储库中,并将其导入到另一台计算机上的存储库中。

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

以某种方式将changes_between_tags.bundle文件传输到远程计算机;例如,通过拇指驱动器。一旦在那有它:

git bundle verify changes_between_tags.bundle  # make sure bundle arrived intact
git checkout [some branch]       # in the repo on the remote machine
git bundle list-heads changes_between_tags.bundle # list the references in the bundle
git pull changes_between_tags.bundle [reference from the bundle, e.g. last field from the previous output]

相反也可以。在远程存储库上进行更改后,就可以捆绑增量。穿上,如拇指驱动器的变化,并把它们合并到本地仓库,所以两者可以保持同步,而无需直接的git,ssh,rsync,或http协议的机器之间的访问。