I have three machines. On the first one, repo machine1
has a develop
branch that is ahead of the develop
branch of the second machine, machine2
. machine2
has fetched it (but not checked out), so it lives as a remote branch machine1/develop
.
Now machine2
is online, but not machine1
, and I'd like to get machine1/develop
into the third machine machine3
.
If I do git fetch machine2
on machine3
, it will update remote branches for local branches of machine2
, but won't get its remote branches.
How can I bring machine1/develop
from machine2
to machine3
, without putting machine1
online? I could stash, checkout, fetch from machine3
, and unstash, but I believe there's an easier way to do this.
Git allows you to specify a particular reference via the refspec
argument: source:destination
.
In this case the command for copying the remote branch from machine2
is
git fetch machine2 refs/remotes/machine1/develop:refs/remotes/machine1/develop