Copying a git repository to USB drive

后端 未结 4 1120
暖寄归人
暖寄归人 2021-02-13 17:27

I am working on an Open Source project and I have a git repo on my machine with all the code. The repo is kind of big, and I would like to keep working on it while I do not have

4条回答
  •  生来不讨喜
    2021-02-13 17:56

    The best way is to add a remote (even though it's a local folder). In this way you can always transfer commits between the two. When you want to move

    git init /mnt/usb/repo
    git remote add usb /mnt/usb/repo
    git push usb master
    

    The last command can be used to push any branches into the folder as desired. If the local branch has no remote currently set as upstream you may have to do --set-upstream.

    See also git how to add a local repo and treat it as a remote one on Stack Overflow.

提交回复
热议问题