简体   繁体   English

Git-设置分支的正确方法

[英]Git - Correct way of setting up branches

I have a repo that I need to use to deploy the production code of an WebApp to the server. 我有一个存储库,用于将WebApp的生产代码部署到服务器。 I need advise on what is the correct way of doing it(branching). 我需要建议什么做正确的方法(分支)。

I will need 3 branches(I think): 我需要3个分支(我认为):

- Development
- Quality
- Production

Now my doubt is... the "master" branch should be used to the Development or to the Production code? 现在,我的疑问是...“ master”分支应该用于开发或生产代码?

Best Regards, 最好的祝福,

Leave the master branch as your main channel, or a preserved state of the working code. 将master分支保留为主通道或工作代码的保留状态。 That way, if something goes really, really wrong, you can revert back to the master branch. 这样,如果某件事确实真的出错了,则可以恢复到master分支。 If you're working with an open source project, put the vanilla engine in the master and branch off of that - it will make updating easier in the future. 如果您使用的是开放源代码项目,请将vanilla引擎放到master引擎中并从中分支出来-它将使将来的更新更加容易。

I'd say keep the branches like they are right now, and sync the servers with their specific branches. 我会说保持分支现在的状态,并将服务器与其特定分支同步。 That way you can easily merge, push, and pull to your respective servers. 这样,您可以轻松地合并,推送和拉入各自的服务器。 That's how my workflow is, using git-hooks to automatically sync the branches. 我的工作流程就是这样,使用git-hooks自动同步分支。

The master branch isn't required. 不需要master分支。 I will delete it sometimes if there isn't an obvious choice. 如果没有明显的选择,我有时会删除它。 However, generally you want it to be the branch people are likely to make changes in most frequently, which in this case is the development branch. 但是,通常您希望它是分支机构,人们可能最频繁地进行更改,在这种情况下,这就是开发分支机构。

Depending on how organized your development is, this workflow works for us: 根据您的开发组织方式,此工作流程可为我们工作:

https://plus.google.com/109096274754593704906/posts/R4qkeyRadLR https://plus.google.com/109096274754593704906/posts/R4qkeyRadLR

Also, for the purposes of publishing, rely on scripts to change connection strings and other config values. 同样,出于发布的目的,请依靠脚本来更改连接字符串和其他配置值。 Smudge/clean scripts could also help. 涂抹/清除脚本也可能有帮助。 Have a look at progit.org/book, specifically the chapter on git attributes. 看看progit.org/book,特别是有关git属性的章节。

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

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