简体   繁体   English

适用于小型团队的Git工作流程

[英]Git workflow for small web team

I know there are already many questions here on this topic, but I've had trouble finding exactly what I need. 我知道这个主题已经有很多问题,但我很难找到我需要的东西。

We're a small team of developers currently using SVN but soon to be making a switch to Git. 我们是一个目前正在使用SVN的开发团队,但很快就会转向Git。 We are used to checking in changes and pushing to the live website throughout the day but currently lack any formal testing procedures, which is something we'd like to add. 我们习惯于检查更改并全天推送到实时网站,但目前缺少任何正式的测试程序,这是我们想要添加的内容。 The way I'm used to doing this with SVN is: 我习惯用SVN做的方法是:

  • develop in a personal test environment 在个人测试环境中发展
  • check in your changes 检查你的更改
  • send the current repository files to a global (production-like) testing webserver, and test 将当前存储库文件发送到全局(类似生产)测试Web服务器,并进行测试
  • send the current repository files to the live webservers 将当前存储库文件发送到实时Web服务器

This obviously can create some problems, especially if communication is not good. 这显然会产生一些问题,特别是如果沟通不好的话。 I've experienced times when untested changes have gone live and that's something we'd definitely like to avoid. 我经历过未经测试的变化已经生效的时候,这是我们一定要避免的事情。

What I'm envisioning is a master Git repository that holds the tested code that is running on the live servers. 我想象的是一个主Git存储库,它包含在实时服务器上运行的经过测试的代码。 Then have a clone of that repository that is used to test revisions. 然后拥有该存储库的克隆,用于测试修订。 I'd like to have a script that is responsible for pulling changes from the requesting developer, putting them in a branch on the test repository, and running some automated tests to make sure nothing major is broken. 我希望有一个脚本负责从请求开发人员那里提取更改,将它们放在测试存储库的分支中,并运行一些自动化测试以确保没有任何重大内容被破坏。 When that all checks out, that branch can be merged and pushed up to the master and out to the live servers. 当所有检出时,该分支可以合并并推送到主服务器并运行到实时服务器。

I'd like to hear any comments about this possible workflow and any suggestions for improvement or how to do it differently. 我想听听有关这个可能的工作流程的任何意见以及任何改进建议或如何以不同方式进行。 Also, any specifics on how to set this up would also be appreciated. 此外,任何有关如何设置此功能的细节也将受到赞赏。 Thanks! 谢谢!

EDIT: I've used the above method for a while now and it's worked out pretty well. 编辑:我已经使用了上面的方法一段时间了,它的效果非常好。

Do you really need a separate repository? 你真的需要一个单独的存储库吗? Your live code is only a single branch; 您的实时代码只是一个分支; you can use other branches for "deploy candidates" under testing. 你可以使用其他分支来测试“部署候选人”。

You don't necessarily need a script to pull the changes - developers could just push them to a separate branch, then invoke a script to test that branch. 您不一定需要一个脚本来提取更改 - 开发人员可以将它们推送到单独的分支,然后调用脚本来测试该分支。

Have you considered code review? 你考虑过代码审查吗? Gerrit might help. 格里特可能会有帮助。
(See Android's Gerrit instance for an idea of the functionality you get.) (请参阅Android的Gerrit实例 ,了解您获得的功能。)

You could then set up a testing environment that would pull a change or set of changes from refs/for/master to the test server. 然后,您可以设置一个测试环境,将一个或多个更改从refs / for / master提取到测试服务器。

This is quite fuzzy in my head, but maybe you find it a useful pointer. 这在我的头脑中非常模糊,但也许你发现它是一个有用的指针。

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

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