0

Background:

1) We are a team of six beginners trying Git and Github for the first time.

2) We created a repo on Github and then all of us cloned it.

3) We then each made our own local feature branches and started working on our first features.

4) Now we have discovered a workflow that uses TWO permanent branches ("master" and "develop") and an arbitrary number of feature branches that come off of "develop" (and go back to it when they are done).

Question:

A) What is the best way to get Github and team repos from the current state of affairs ("master") to what we want ("master" and "develop")?

B) What tracking should each member of the team setup? I.e., we are all interested in staying current with "develop" on Github so we can rebase our feature branches often, for example.

Thanks and sorry if this is a "dumb" question. I feel like the answer is staring me in the face, but I don't have the confidence and would like some help from an experienced Git user, ideally one who uses a workflow similar to what I am taking about. Thanks.

4

1 回答 1

1

阅读这篇文章,它精美地解释了如何与多个开发人员一起使用 git 管理您的项目。我相信这篇文章的摘要可以用这张图来呈现:

git 工作流程
(来源:nvie.com

A) 将 Github 和团队存储库从当前状态(“master”)变为我们想要的(“master”和“develop”)的最佳方式是什么?

这很容易。您当前master的分支相当于develop上图中的分支。因此,您只需要分支一个develop分支并让您的开发人员使用而不是master.

B) 团队的每个成员应该设置什么跟踪?即,我们都对在 Github 上保持最新的“开发”感兴趣,因此我们可以经常重新设置我们的功能分支,例如。

因此,就develop分支而言,您威胁它的方式与您过去威胁的方式相同master。几乎没有任何区别。现在master分支将变得特别。它应该始终稳定并可供其他人下载。因此,您应该master只向可信数量的人授予推送权限(我不确定这是否git适合您,或者您只需要告诉人们并希望他们服从)。一个可以推送到 master 的人将负责master分支中的任何更改。

请注意,开发人员仍然可以发布hotfixes和合并它们develop,但他们应该让有特权的人将它们合并到master.

release分支机构可以采用与master.

至少强制执行权限的一种方法是拥有另一个存储库master,开发人员可以在其中发出“拉取请求”,而有权限的人可以接受拉取。这实际上是 Linux 内核的管理方式。在 Linux 内核中,有一个master由 Linus 自己管理的存储库。develop他的副手维护着几个分支机构,他们不时地向他发送“拉取请求”。

于 2012-10-15T13:17:25.863 回答