[英]Using git branches for multiple developers
We have a project, that has multiple developers. 我们有一个有多个开发人员的项目。 Each developer has his own feature branch and once the feature is complete, it is merged with master and pushed to the remote repository.
每个开发人员都有自己的功能分支,一旦功能完成,它将与master合并并推送到远程存储库。 The problem arises:
问题出现了:
If several people are working on features and they all push their changes and one of the features is buggy. 如果有几个人正在使用功能,而他们全都推动了更改,那么功能之一就是越野车。 Is there a way all of the features can be pushed to a secondary master in remote, run tests and if everything goes well, push to the master in the remote?
有没有一种方法可以将所有功能推送到远程主机中的辅助主机,运行测试,如果一切顺利,则可以推送至远程主机中的主机?
Lets say all the developers are working on their feature and an emergency fix comes up, how is that best handled? 可以说所有开发人员都在开发其功能并提出紧急修复程序,如何最好地解决? It is possible that some of the developers have pushed already, but we want to push only the emergency fix?
某些开发人员可能已经推送了,但是我们只希望推送紧急修复程序吗?
Ad 1. Yes, it is possible. 广告1.是的,有可能。 Just create another branch in the remote repo as the "secondary master" if you wish so.
如果愿意,只需在远程仓库中创建另一个分支作为“二级主服务器”即可。 You can name it whatever you like, for example devel .
您可以随意命名,例如devel 。
Ad 2. Our team has branch called production , which should be the exact same version of what is running on production servers and from which we are deploying. 广告2。我们的团队有一个名为production的分支,该分支应该与生产服务器上正在运行以及从中进行部署的版本完全相同。 So when we need to apply hotfix, we don't have to worry about the current status of master - we just apply it to production .
因此,当我们需要应用修补程序时,我们不必担心master的当前状态-我们只需将其应用于生产 。
I recommend to read this, at least for inspiration: A successful Git branching model 我建议阅读这篇文章,至少是出于启发: 成功的Git分支模型
Those are all easy to do with git. 使用git可以轻松完成这些任务。 The idea would be this:
这个想法是这样的:
master
branch which is "stable" master
分支 staging
branch which tracks master and gets the feature merges first: this is where final testing is done. staging
分支首先合并:这是完成最终测试的地方。 If an emergency fix is done on master, this can be handled in several ways: 如果对主机完成了紧急修复,则可以通过以下几种方法进行处理:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.