0

I didn't find any good documents for detailed usage or example of multiple remote server and I hope someone here can help me with it.

1.When and why do we need to add a second remote server?

2.In the book "Git pro", the example is regarding an internal repo which looks like a mirror to the remote code server. If this is a mirror, how to sync with the true remote server?

enter image description here

3.If I checkout the mirror and make some commit, how can I merge it into the true remote master?

Ben James
  • 121,135
  • 26
  • 193
  • 155
deepsky
  • 845
  • 1
  • 10
  • 24
  • 1. For example, you can use multiple remote servers to share your code with others (say you and your team members are working through one remote repo, but you want to share your code with someone else through another repo, or you want to make a backup). Another situation is when you working with one main remote repo, but also using git to deploy your code to live servers. 2,3. In git all remote servers are "true" according to your mean. So you can interact with them via pull/push commands. Just pull branch from one remote, make commits and push it to another remote or to both, it's up to you. – tijs Jul 01 '13 at 14:57
  • 2
    This question appears to be off-topic because I think it would be more suitable for Programmers.StackExchange. – JMK Jul 01 '13 at 16:35
  • This question seems to be about the social usage of git among a team of programmers, as opposed to how to do something with git. So it is off-topic on [so], but should be fine for [programmers.se]. – Gilles 'SO- stop being evil' Jul 01 '13 at 17:24

1 Answers1

1
  1. Where I work we developers have frequently used each other's repos as remotes. This can be used for:

    • Code reviewing code that has not been pushed to the central repo
    • Getting locally committed code from someone that is home sick.
    • Getting information on the state of someone else's work.
    • Cooperating on code not yet pushed to the central repo (though it is often better to push to a remote feature branch instead)
  2. and 3. You can create a true mirror using git clone --mirror and then git remote update to sync. But in these examples I don't think they mean that sort of strict mirror. It is more of a loose one, where you can sync just by pull from and then push to the true remote master, as usual.

Community
  • 1
  • 1
Klas Mellbourn
  • 42,571
  • 24
  • 140
  • 158