简体   繁体   English

在基于Web的开发环境中使用GIT源代码控制

[英]Using GIT source control within a web based development environment

I am currently using GIT with source Tree to manage my source control for a php web system. 我当前正在将GIT与源代码树一起用于管理php Web系统的源代码控制。

My Previous experience with GIT is with a none web based environment and there for I understand the use of branches and remotes etc. 我以前在GIT方面的经验是在非基于Web的环境中进行的,因为我了解分支机构和遥控器的用法。

But I am a little confused when it comes to setting this up for web development. 但是,在为Web开发进行设置时,我有些困惑。

Scenario. 场景。

I have a live subdomain 我有一个实时子域
live.mysite.com live.mysite.com

I have a dev subdomain 我有一个开发子域
dev.mysite.com dev.mysite.com

I create branches off the dev site for stories. 我在开发站点外创建了分支来编写故事。 staff checkout the story branches from the dev site, complete and commit. 工作人员从开发站点签出故事分支,完成并提交。 Each story is then checked out by a tester and tested, once completed the story is merged to the dev master and eventually dev is merged with live. 然后,每个故事都将由测试人员签出并进行测试,完成后,故事将被合并到开发人员主机中,最终开发人员将与现场合并。

This is a very broad overview and my confusion comes with the domains. 这是一个非常广泛的概述,而我的困惑来自领域。 lets say i have 10 staff members. 可以说我有10名工作人员。 They will need to view there changes as they do them the same with any development. 他们将需要查看那里的更改,因为它们与任何开发都一样。 Using the above method wouldnt work because all staff members would be deploying to the dev site. 使用上述方法将无法正常工作,因为所有员工都将部署到开发站点。

To get round this i have been creating a subdomain for each staff member. 为了解决这个问题,我一直在为每个工作人员创建一个子域。

rob.mysite.com rob.mysite.com

dave.mysite.com dave.mysite.com

Now the staff can each work on there own domain independently and push to different remotes when needed. 现在,每个员工都可以独立地在自己的域上工作,并在需要时推送到不同的遥控器。 ie

make changes on rob.mysite.com push rob to dev push dev to live etc 在rob.mysite.com上进行更改将rob推送到dev推送dev进行直播等

Although this sort of works i feel it is not correct. 尽管这种工作我感觉是不正确的。

It almost breaks the whole point of branches as all staff would be branching from there own repository. 由于所有员工都将从自己的存储库中进行分支,因此几乎破坏了分支机构的整体观点。

Is this correct and am I just a few steps short or am I completely off? 这是正确的吗,我只是短短几步,还是我完全离开了?

First of all, it sounds like staff members need a local development environment. 首先,听起来工作人员需要本地开发环境。 Developers should not need to push any changes to test them. 开发人员无需推动任何更改即可对其进行测试。 This slows down development a lot. 这大大减缓了开发速度。

A common workflow could look like this: 常见的工作流程可能如下所示:

  1. Select stories to work on. 选择要处理的故事。
  2. Develop your feature. 开发您的功能。
    1. Optionally, create a branch for it, which is based on the master or development branch. (可选)为其创建一个分支,该分支基于master或development分支。 The so called feature branch. 所谓的功能分支。 Technically, if a developer commits locally, this already is a branch. 从技术上讲,如果开发人员在本地提交,则该分支已经存在。
    2. Optionally, push changes to a remote copy of the feature branch whenever you like to have a backup of your work. (可选)在需要备份工作时将更改推送到功能分支的远程副本。
  3. Check if your changes work in a local development environment and run the tests. 检查您的更改是否在本地开发环境中起作用并运行测试。
  4. If tests are green merge the feature branch into master/development branch. 如果测试是绿色的,则将功能分支合并到master / development分支中。
  5. Deploy master/development to the staging environment and have testers test it. 将主/开发部署到暂存环境,并让测试人员对其进行测试。
  6. If tests are good merge master into live and deploy to live. 如果测试良好,则将master合并为live,然后部署为live。

You might have noticed that this is not much different to your approach. 您可能已经注意到,这与您的方法没有太大不同。 You will have all changes in one single staging environment. 您将在一个单一的暂存环境中进行所有更改。 However, this is a good thing. 但是,这是一件好事。 You will recognise incompatibilities between features there, not in live. 您会发现其中的功能之间存在不兼容,而不是实时存在。

I would like to recommend learning more about Continuous Integration and Continuous Delivery . 我想建议您学习有关持续集成持续交付的更多信息。

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

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