小型 Web 团队的 Git 工作流程
我知道关于这个主题已经有很多问题,但我很难找到我真正需要的东西。
我们是一个由开发人员组成的小团队,目前使用 SVN,但很快就会切换到 Git。我们习惯于全天检查更改并推送到实时网站,但目前缺乏任何正式的测试程序,这是我们想要添加的内容。我习惯使用 SVN 执行此操作的方式是:
- 在个人测试环境中进行开发,
- 检查您的更改,
- 将当前存储库文件发送到全局(类似生产)测试网络服务器,然后进行测试,
- 将当前存储库文件发送到实时网络服务器
这显然会产生一些问题,尤其是在沟通不好的情况下。我曾经经历过未经测试的变更就已上线的情况,这是我们绝对希望避免的事情。
我设想的是一个主 Git 存储库,其中包含在实时服务器上运行的经过测试的代码。然后克隆该存储库,用于测试修订。我想要一个脚本,负责从请求开发人员那里提取更改,将它们放入测试存储库的分支中,并运行一些自动化测试以确保没有任何重大问题。当一切检查完毕后,该分支可以合并并推送到主服务器并推送到实时服务器。
我想听听有关此可能的工作流程的任何评论以及任何改进建议或如何以不同的方式进行操作的建议。此外,任何有关如何设置的具体信息也将不胜感激。谢谢!
编辑:我已经使用上述方法一段时间了,效果很好。
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. 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:
- develop in a personal test environment
- check in your changes
- send the current repository files to a global (production-like) testing webserver, and test
- send the current repository files to the live webservers
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. 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您真的需要一个单独的存储库吗?您的实时代码只是一个分支;您可以使用其他分支进行测试中的“部署候选人”。
您不一定需要脚本来提取更改 - 开发人员只需将它们推送到单独的分支,然后调用脚本来测试该分支。
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.
您考虑过代码审查吗? Gerrit 可能会有所帮助。
(请参阅 Android 的 Gerrit 实例,了解您获得的功能。)
然后您可以设置一个测试将从 refs/for/master 提取一个或一组更改到测试服务器的环境。
这在我的脑海中很模糊,但也许你会发现它是一个有用的指针。
Have you considered code review? Gerrit might help.
(See Android's Gerrit instance for an idea of the functionality you get.)
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.
This is quite fuzzy in my head, but maybe you find it a useful pointer.
我发现这非常有帮助:
http://nvie.com/posts /a-successful-git-branching-model/
I found this to be extremely helpful:
http://nvie.com/posts/a-successful-git-branching-model/