6

在我的一个大学项目中,我是一个由 4 名开发人员组成的小组,负责从头开始开发 Web 应用程序。我们都对 Git 有非常基本的了解,并决定使用它进行代码库协作,我们建立了一个 repo,每个人都是 GitHub 上的协作者。

在过去的几个月里,我们只是简单地克隆并提交到主分支,并且效果很好。然而,最近,有时两个或更多人同时在代码库上工作,我们经常会遇到一些人落后于提交并且必须在提交之前克隆 repo,这有时会导致他们的更改被丢失的。

今天,一个小组成员谈到有一个“开发”分支,我们都克隆和提交,然后在每个 sprint 结束时合并到 master 分支。我们尝试了这个,但并没有真正看到改进,因为我们仍然使用相同的代码库,所以会出现与以前相同的问题。

其他人有分叉(这对我来说是新事物)主仓库的想法,对其进行处理,然后将拉取请求发送到主仓库,然后可以将其合并。这在实践中听起来是一个不错的计划,因为如果更改破坏了代码,则可以查看更改并进行修复。反正我是这么理解的。

但正如我所说,我们都是 Git 的新手,并且对整个想法有一个非常基本的了解。组织一个由 4 名开发人员组成的团队处理 Git 存储库的标准方式是什么?我查看了一些 Git 文档,但对于只知道如何克隆和提交到主分支的人来说,这一切都相当混乱。

感谢您的任何帮助!

4

2 回答 2

3

您需要查看 Git 工作流和/或分支模型。有很多,这里有一个开始:

一个成功的 git 分支模型

您需要考虑发布、登台、生产等概念,因为这很容易表示。基本上都是关于组织的。

于 2013-03-25T22:15:43.750 回答
0

Talking about things being "standard" in development methodologies is dangerous because there is almost no such thing. Groups of developers tend to organise themselves in ways that work for them (or in the way that management tell them to organise themselves).

All of the approaches you have identified are valid ways of using distributed version control systems. I would suggest that you're not seeing massive benefit from the alternatives because you're working on a university-sized green field project with a small team of people in the same geographical location, speaking the same language, with similar abilities, and with similarly clear ideas of what the outcome should be. Git tends to shine when any of those are not the case.

For distributed projects where you really want one person to be acting as gate keeper to the canonical version of the project, pull requests work really nicely. When you want everyone to have effectively equal commit access, a development branch is a good solution. People tend to use development branches so that they can have an always-working version hanging around for people to use. I assume you don't currently have users, which is why you are unlikely to see much benefit from this approach.

I would basically continue as you are unless you talk to each other and decide that something is not working for you as a team, in which case you can decide if one of the other ways of working are going to be better for you.

于 2013-03-25T22:16:44.240 回答