Git push/pull between team members local repositories

nyzm picture nyzm · Aug 16, 2013 · Viewed 9.8k times · Source

Lets say there is a team with 4 developers. We also have a central repository for our project. Developers push and pull from central repository. Here(in Decentralized but centralized section) it says that its possible to push/pull between team members local repositories.

Each developer pulls and pushes to origin. But besides the centralized push-pull relationships, each developer may also pull changes from other peers to form sub teams...Technically, this means nothing more than that Alice has defined a Git remote, named bob, pointing to Bob’s repository, and vice versa

Now question is how to define remote name bob which is pointing to Bob's repository. If it matters developers possibly use different operation systems.

Answer

Bijendra picture Bijendra · Aug 16, 2013

It's a very common thing like Alice and Bob need to work on some functionality together. In the mean time, the development should be carried on different branches by different developers.

Simple approach would be:

  • Create a new branch sprint_1, Alice and bob checkout to sprint_1
  • All the changes related to functionality should be done here
  • Push and pull operations should be performed using

    git pull origin sprint_1  and git push origin sprint_1
    

When the changes are done and sprint_1 has a stable code, it could be merged with other branch. If the code on sprint_1 has come a long way, it is advised to rebase the branch than merge to avoid conflicts or cherry picking.