简体   繁体   English

git中央存储库和团队

[英]git central repository and Team

I have been playing around with GIT on my local computer. 我一直在我的本地电脑上玩GIT。

As I have gain a bit of knowledge using GIT like add, commit, merge, branch, checkout, status. 因为我使用GIT获得了一些知识,如添加,提交,合并,分支,结帐,状态。

I still have more to learn but im confuse one thing.. how does git handle team? 我还有更多需要学习的东西,但我很困惑一件事...... git如何处理团队?

For example: 例如:

  • Developer A computer 开发人员计算机
  • Developer B computer 开发者B计算机
  • Developer C computer 开发者C计算机
  • 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 branch (master?) to central repository via SSH remote. 从我的理解(纠正我,如果我错了).. A,B和C开发人员通过SSH远程将他们的分支(主?)推送到中央存储库。

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. 这是git中的“远程”(我相信很多其他DVCS )都会说话。 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 . 您可以通过执行git fetch origin来找出已将哪些分支推送到原点(以及更多,例如标记)。 When doing a git pull , you are really doing a git fetch , followed by a git merge . 在进行git pull ,你实际上正在进行git fetch ,然后是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. 从我的理解(纠正我,如果我错了).. A,B和C开发人员通过SSH远程将他们的分支(主?)推送到中央存储库。

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. 就像origin一样,master是一个命名约定,恰好是在将目录初始化为git存储库时为您创建的分支。

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 . 见上文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. Central repo不需要合并任何内容,因为它不会有自己的提交。 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/ http://nvie.com/posts/a-successful-git-branching-model/

看看Pro Git第5章 - 它应该回答你关于Git工作流程的所有问题。

May I suggest that you take open reading Pro Git, and freely distrubuted book about Git: http://progit.org/ 我建议您开放阅读Pro Git,并自由发表关于Git的书: http//progit.org/

And in particular the chapter about maintaining a project: http://progit.org/book/ch5-3.html 特别是关于维护项目的章节: http//progit.org/book/ch5-3.html

Happy travels ;) 旅途愉快 ;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM