在本地計算機上建立 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]

反過來也是可能的。在遠端儲存庫上進行更改後,可以繫結增量; 將更改放在例如拇指驅動器上,然後將它們合併回本地儲存庫,這樣兩者就可以保持同步,而無需在機器之間直接進行 gitsshrsynchttp 協議訪問。