本文介绍了master分支应该在git中包含什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了多种不同的git分支策略,但令我惊讶的是,master分支经常被用作生产就绪分支,并且还会有一个uat和dev分支。
我正在考虑使用相同的3个分支来设置git存储库,但让 master包含开发代码并添加生产和uat分支。这样,开发人员可以简单地合并到默认的git分支(即 master)。有没有理由不这样做?

I have read about multiple different git branching strategies and I was suprized that the master branch was often used as a 'production-ready' branch and there would be an additional uat and dev branch.I'm thinking to set up our git repository with the same 3 branches, but to let 'master' contain the dev code and add a production and uat branch. That way, developers can simply merge to the default git branch (being 'master'). Is there a reason not to do it like that?

gr,

Coen

推荐答案

没有特别的理由不选择一个工作流程,而Git通常由开发团队自行决定以决定其最佳实践。

There is no specific reason not to pick one workflow over another, with Git it's usually left to the discretion of the development team to decide their best practice.

您提到的生产就绪型主方法通常有多个dev分支(有时称为Feature分支),然后选择master作为放置所有这些的最后位置通常应该只有一个主分支(通常只有一个生产分支)。

The production-ready master approach you mentioned often has more than one dev branch (sometimes called feature branches), master is then chosen as the final place to put all these since there should typically be only one master branch (and often only one production build).

这是有多少家公司在工作,但当然不是全部。许多其他人使用的是不稳定的主服务器方法,该方法与您提到的模式类似:有些人拥有生产存储库,他们自己的主服务器和分支被认为是不稳定的,而团队负责人在代码中添加代码时会推送到生产仓库

This is how many companies work, but certainly not all. Many others use an "unstable master" approach, which follows a similar pattern to the one you mention - some instead have a production repository, their own master and branches are considered unstable, and the team leader pushes to the production repo when code in a particular branch is considered production ready.

这里Git的关键方面是每个人都有自己的本地存储库,以及自己的分支和主服务器。这样一来,他们便可以根据自己认为合适的邪恶目的,随时随地创建自己的私有分支,但这确实使定义分支名称的目的变得更加难以实施。

The key aspect in Git here is that everyone has their own local repository, with their own branches and master. This allows them to create their own private branches any time they want, for whatever evil purposes they see fit, but it does make defining the purpose of branch names more difficult to enforce.

这篇关于master分支应该在git中包含什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:05