How to use a USB stick as a remote
Plug your USB drive into your desktop computer and assume it shows up as J:
-
Initialize a bare repo that will act like a remote:
git init --bare J:\repo_name
-
cd
to your local repo and:git remote add usb J:\repo_name git checkout master git push usb master
The fork is master
synchronized with the remote usb
. Now plug in your USB stick to your laptop and assume it shows up asD:
git remote add usb D:\repo_name
git checkout master
git pull usb master
If you are trying to pull a branch that doesn't exist on the laptop but it works on the desktop, you can simply do git checkout the_branch
and it will automatically pull it from usb
(if the_branch
it doesn't also exist in origin
, in which case you should do git checkout -b the_branch usb\the_branch
)
You may need git fetch
it if it doesn't find the remote usb branch.
If you later plug in your USB drive and display it as a different letter, for example K:
, follow these steps:
git remote set-url usb K:\repo_name
source to share