git repository sync between computers, when moving around?

前端 未结 8 808
萌比男神i
萌比男神i 2020-12-07 07:18

Let\'s say that I have a desktop pc and a laptop, and sometimes I work on the desktop and sometimes I work on the laptop.

What is the easiest way to move a git repo

8条回答
  •  半阙折子戏
    2020-12-07 07:51

    I would clone the repo from one box to the other, and then set up the two repos so that I can just git fetch from the other box.

    Renaming the remote from origin to the name of the other box makes the remote branches easier to read.

    Note that by just using git fetch (and not git push), this works well with non-bare repositories:

    [user@foo repo]$ git fetch -v bar
    
    [user@bar repo]$ git fetch -v foo
    

提交回复
热议问题