37

So let's say there are three developers: Alice, Bob, and Cecil. They decide to use Git without a central repo. They all set up remotes to each other, so that:

  • Alice has remotes/bob/master
  • Alice has remotes/cecil/master
  • Bob has remotes/alice/master
  • Bob has remotes/cecil/master
  • Cecil has remotes/alice/master
  • Cecil has remotes/bob/master

And now, Alice wants her local master branch to track both remote master branches. Is that even possible in Git? If not, what workflow do you guys use to work around this?

Michael
  • 8,362
  • 6
  • 61
  • 88
Jasiu
  • 2,674
  • 2
  • 27
  • 27

1 Answers1

23

How to track more than one remote with a given branch using Git?

In short, "can't be done unless you write a custom script/program/alias".

I suggest that they either agree on a common central branch that holds the development tree, or that they send each other pull requests instead of asking each developer to track every other developer.

Community
  • 1
  • 1
Arafangion
  • 11,517
  • 1
  • 40
  • 72
  • 15
    This doesn't work well in some models. For example, I frequently fork github projects and work locally. I'd like to have git status tell me where I am relative to both origin and upstream, so I know if my fork is behind upstream. – Phil Lello Jun 12 '16 at 12:19
  • 1
    Yeah I wish my github master could track the upstream master and my local master could track my github master and they all updated automatically – endolith Jul 19 '20 at 16:29