git central repository and Team
I have been playing around with GIT on my local computer.
As I have gain a bit of knowledge using GIT like add, commit, merge, branch, checkout, status.
I still have more to learn but im confuse one thing.. how does git handle team?
For example:
- Developer A computer
- Developer B computer
- Developer C computer
- Central repository (Server)
All Developers working on the same project.
From what I understood (correct me if im wrong).. A ,B and C developers push their branc开发者_开发技巧h (master?) to central repository via SSH remote.
But on the central repository, how do I get information or which files (or branch?) that has been pushed from the developers... What would it look like on the central repository?
On the central repository, how would handle merges developers work?
Thanks.
There is no "central repository", per se. You will typically create one because it works out nicely for working in a team and keeping everything/everyone organized.
When setting up this central repository, you will give it a name of some sort. This is your local reference point to this central repository, not everyone on your team has to necessarily call it the same thing. This is a 'remote' in git (and I'm sure many other DVCSs) speak. Most people tend to name it 'origin'. You can find out what branches have been pushed to the origin (and more, such as tags) by doing a git fetch origin
. When doing a git pull
, you are really doing a git fetch
, followed by a git merge
.
From what I understood (correct me if im wrong).. A ,B and C developers push their branch (master?) to central repository via SSH remote.
It doesn't necessarily have to be master. Just like origin, master is a naming convention and happens to be the branch that gets created for you when you initialize a directory as being a git repository.
But on the central repository, how do I get information or which files (or branch?) that has been pushed from the developers... What would it look like on the central repository?
See above re: git fetch
.
On the central repository, how would handle merges developers work?
You don't have to handle merges on the origin because a developer will have to pull the latest work from everyone else on whatever branch they are working on, before they can push their changes to the origin (and in particular, that branch).
I hope this helps. I am far from understanding all of the ins-and-outs of how it all really works.
Central repo won't need to merge anything as it won't have its own commits. It's developers job to merge changes. Central repo will merely fast-forward on commit, or reject commit if other developer pushed before.
A great description of how to organize your repository and how to handle team branches can be found at:
http://nvie.com/posts/a-successful-git-branching-model/
Take look at the Pro Git book chapter 5 - it should answer all your questions about Git workflow.
May I suggest that you take open reading Pro Git, and freely distrubuted book about Git: http://progit.org/
And in particular the chapter about maintaining a project: http://progit.org/book/ch5-3.html
Happy travels ;)
精彩评论