简体   繁体   English

我应该如何将Git用于开发和生产服务器?

[英]How should I use Git for development and production servers?

I've just been brought into a project where the developers have been working directly on the production site over ftp - then pushing changes to the master repo on git afterwards. 我刚刚进入一个项目,开发人员一直在直接通过ftp在生产站点上工作-然后将更改推送到git的主仓库中。 I want to bring in a development server, but as I'm a newbie to Git I'm not 100% how it integrates into the workflow. 我想引入一个开发服务器,但是由于我是Git的新手,所以我并不是100%如何将其集成到工作流中。 My current understanding is that it would go as follows: 我目前的理解是,它将进行如下操作:

  1. Developers code via ftp on to the development server 开发人员通过ftp到开发服务器上的代码
  2. Progress is then pushed to a development branch on the Git Repo 然后将进度推送到Git Repo上的开发分支
  3. Releases can then be merged to the master branch 然后可以将发行版合并到master分支
  4. The production site is updated by pulling code from the master repo. 通过从主存储库中提取代码来更新生产站点。

Does that sound about right? 那个听起来是对的吗?

Convention is to have a Development branch which represents a deployable state for the code along with feature and fix branches that will eventually be merged into that branch. 约定将具有一个Development分支,该分支代表代码的可部署状态以及功能和修订分支,这些分支最终将合并到该分支中。 Finally you conventionally have branches representing each server. 最后,按常规,您有代表每个服务器的分支。

Developers should never code direct to the server they should code to git and the process of getting to the server should be a deploy from git. 开发人员切勿直接将代码编写到服务器,而应将代码编写到git,并且到达服务器的过程应是从git进行的部署。 There are CI tools for almost any environment that will make that process automatic by monitoring git repositories so don't be afraid to use them. 几乎所有环境中都有CI工具,可以通过监视git存储库使该过程自动进行,因此不要害怕使用它们。

Ultimately, GIT should be the focus of the developers and they really shouldn't even know the server's IP addresses (they don't need to) Systems admins should be setting up CI (Continuous Integration) tools that run unit tests and deploy automatically if everything is kosher. 最终,GIT应该成为开发人员的重点,他们甚至根本不知道服务器的IP地址(他们不需要)。系统管理员应该设置CI(连续集成)工具,该工具可以运行单元测试并在需要时自动部署一切都是洁食。

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

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