是的,使用您的USB驅動器作爲裸倉庫絕對是一個可行的解決方案,如果你問我,這是一個相當優雅的解決方案。然後您可以推送它並從中獲取,就像使用中央存儲庫一樣。 (最廣泛的意義上)存儲庫(「遙控器」),所以在你的辦公室電腦上,你可以簡單地將USB驅動器添加爲第二個遙控器。根據您的使用情況,您可能有時必須使用合併來重新獲得兩個不同的遠程同步,但這與正常合併沒有區別。至少,Git沒有什麼不同。
這裏是一個濃縮的例子:
# setup bare repo on USB drive, e.g. using 'git clone --bare'
# on office PC
(work work work)
git remote add stick /path/to/repo/on/stick
git push stick <branches> # can use --all
# elsewhere
git clone /path/to/repo/on/stick
(work work work)
git push stick <branches>
# back in office
git fetch stick
(compare diffs or whatever you like)
git merge stick/mybranch
# etc.
PS。當然你也可以使用rebase,如果你願意並且知道你的解決方法。