'Copying git local branch between machines?
OK so I'm tracking a remote repo on two machines so both have the master branch. I also made a local branch on my laptop called development. Is there a way for me to copy that local branch over to my desktop computer? I'd use my laptop but for some reason I'm having trouble with gdb and emacs...
Edit: This worked for me
git remote add laptop [username]@hostname:/path/to/repo
git fetch laptop
git checkout --track -b development laptop/development
git pull
Solution 1:[1]
Can you not just git pull the remote branch from your laptop? Git will pull over http, ssh - many protocols. My git syntax is rather rusty, but something likeā¦
Edit: Digging through memory and manuals, you may need to initially add the new remote with
git remote add ssh://remotestuff/
then you can
git checkout --track -b localBranchName remote/remoteBranch
to track the branch.
Solution 2:[2]
You can copy the repo in a usb stick, plug it in the second laptop/pc, cd to the repo and do:
git remote add usbstick path/to/repo/in/usbstick
git fetch usbstick
git branch branch_name usbstick/branch_name
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Anna A. |
