在本地计算机上创建 git 包并在另一台计算机上使用它
有时你可能希望在没有网络连接的计算机上维护 git 存储库的版本。Bundles 允许你在一台机器上的存储库中打包 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
协议访问。