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.
Using the command lineAdd a connection to your friend's version of the github repository, if you haven't already. Pull his/her changes. Push them back to your github repository. The pull request on github will be automatically closed.
Using git pullUse git pull to update a local repository from the corresponding remote repository. Ex: While working locally on master , execute git pull to update the local copy of master and update the other remote tracking branches.
You can add multiple remotes by using git remote or git config commands or editing the config file. As git can group multiple remotes, you can follow any of the following ways to configure multiple remotes to push simultaneously(no need all). You can set multiple remote URLs to a single remote using git remote.
If you establish a user account on the host and access permission on the repo, someone else can push/fetch over SSH with or without establishing a named "remote".
git push user@host:/path/to/repo branch
If you share code frequently, you can setup a named remote to remember the server path:
git remote add remotename user@host:/path/to/repo
If it's OK that sharing involve close coordination (and probably very loose security), you can fire up a short-lived git daemon
on the "master" as needed: git equivalent of 'hg serve'? In this case, the above sharing commands still apply, but the user@host:/path
will be replaced by git://host/
. See also git daemon documentation.
Alternatively, you could setup a separate dedicated repository to use for intermediate sharing: How do I setup a staging repository in git?
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With