Reputation: 4181
Git is distributed source control system, right. How to connect two developers without a centralized repository.
Our team uses Github and if two developers want to work on the same branch it seems that branch needs to be pushed to the remote before they both have access to it...or does it?
Can a developer pull from another developers local repository?
Upvotes: 2
Views: 222
Reputation: 4513
If you're already using Github, then the easiest way to get both of you working on the same branch is to push/pull from Github continuously. Pushing / Pulling from each other's machines will get hairy quickly and result in a lot more headache down the road. Of course, you can use another in house server or set up a bare repo on one or both of your machines, but this will likely lead to an overly complex setup and cause a lot of extra time and effort in managing the source.
To get started between you (Dom) and another developer (we'll call him John) on the same branch, first create the branch on your local machine and push it up to Github:
#On Dom's machine:
git checkout -b cool_feature
git push origin cool_feature #assumes origin is github
#on John's machine:
git checkout -b cool_feature
git pull origin cool_feature
Now you both have the same copy of the repo on your localhosts. Develop at will and make sure both of you commit often and push the commits up to Github. Also, make sure you pull from Github often.
Upvotes: 0
Reputation: 992707
It depends on how well connected those two developers are. If you're working on the same machine, then you can pull directly from the other user's clone. If you're working on the same network, you can set up a simple server with something like git daemon
.
If you're on separate networks behind firewalls and whatnot, then you can share changes using a shared common server. Or, you could email patches to one another using git format-patch
and git am
.
Upvotes: 1
Reputation: 22596
Yes, you need to use the git remote add ...
command to add the each user repository visible to each user. Obviously, they need to be able to see each other computer. You might have to setup ssh or use a git daemon
.
Upvotes: 0
Reputation: 47762
Can a developer pull from another developers local repository?
Yes. A readonly access (nfs, ssh, ...) to the repository (ie. the actual files in .git
directory) of the other developer is sufficient. Or, if a developer installs a git server, others can pull from it.
I'm not counting the possibility of sending patches by mail.
Upvotes: 5