バンドル!
git bundleを使用したワークフローは、基本的に他のワークフローと同じになります。これはそれほど役立つアドバイスではないように思われるかもしれませんが、ここでは、通常使用するワークフローを使用し、「プッシュ/プル」を「フラッシュドライブでバンドルをここに運んでからプルする」に置き換えます。
マニュアルページには、これを実行するためのかなり良いチュートリアルがありますが、これは一方向の例です。完全を期すために、これを少し変更したバージョンを示し、情報を双方向に移動する方法を示します。
# on hostA, the initial home of the repo
hostA$ git bundle create hostA.bundle --branches --tags
# transfer the bundle to hostB, and continue:
hostB$ git clone /path/to/hostA.bundle my-repo
# you now have a clone, complete with remote branches and tags
# just to make it a little more obvious, rename the remote:
hostB$ git remote rename origin hostA
# make some commits on hostB; time to transfer back to hostA
# use the known master branch of hostA as a basis
hostB$ git bundle create hostB.bundle ^hostA/master --branches --tags
# copy the bundle back over to hostA and continue:
hostA$ git remote add hostB /path/to/hostB.bundle
# fetch all the refs from the remote (creating remote branches like hostB/master)
hostA$ git fetch hostB
# pull from hostB's master, for example
hostA$ git pull
# make some commits on hostA; time to transfer to hostB
# again, use the known master branch as a basis
hostA$ git bundle create hostA.bundle ^hostB/master --branches --tags
# copy the bundle to hostB, **replacing** the original bundle
# update all the refs
hostB$ git fetch hostA
# and so on and so on
注意すべき重要な点は、バンドルをリモートとして追加し、他のリモートと同じように操作できることです。そのリモコンを更新するには、新しいバンドルをドロップして、前のバンドルを置き換えます。
私はまた、基礎を選ぶために少し異なるアプローチを取りました。マニュアルページはタグを使用し、他のホストに転送された最後の参照を常に最新の状態に保ちます。他のホストから転送された最後の参照を参照するリモートブランチを使用しただけです。少し非効率的です。一歩遅れているので、必要以上にバンドルすることになります。しかし、フラッシュドライブは大きく、バンドルは小さく、余分な手順を踏んでタグに注意する代わりに、すでに持っている参照を使用すると、多くの労力を節約できます。
バンドルを少し厄介にする1つのことは、バンドルにプッシュできず、バンドルを「リベース」できないことです。新しい基準に基づいてバンドルが必要な場合は、それを再作成する必要があります。新しいコミットが必要な場合は、再作成する必要があります。この面倒は私の次の提案を引き起こします...
サムドライブのレポ
正直なところ、レポが本当に大きくない限り、これは同じくらい簡単かもしれません。ベアクローンをサムドライブに置くと、両方のコンピューターにプッシュしたり、そこからプルしたりできます。ネットワーク接続のように扱ってください。中央リポジトリに転送する必要がありますか?プラグを差し込んでください!