Git 生产/登台服务器工作流程

发布于 2024-09-25 15:37:58 字数 807 浏览 0 评论 0原文

目前我的网站(生产服务器)已经有很多代码了。 现在我想开始在我的项目中使用 Git 并为我的团队设置一个临时服务器。 有人可以给我任何建议吗?

这是我脑海中的画面:

        Production        - Production server which already have codes
            ↑             
         Staging          - New staging server, will install Trac too
         ↗↙ ↖↘          
  Developer1  Developer2  - Local development 

我的问题是,我应该如何开始?

我想到了一些步骤:

  1. 在生产服务器中执行git init(这安全吗?)
  2. 克隆将存储库从生产服务器开发到登台服务器
  3. 克隆 将存储库从暂存到本地计算机
  4. push 文件到暂存服务器,在
  5. 暂存准备就绪时完成更改,push 将所有内容推送到生产环境

这个工作流程是否有意义,或者有更好的方法吗?

如果我只想更改一个文件怎么办?

这个过程中origin/master有什么关系吗? 起源是谁?我最终会拥有多个起源吗?

另外,在这种情况下,开发人员什么时候应该使用branch

Currently my website (production server) already have a lot of code in it.
And now I want to start using Git for my projects and setup a staging server for my team.
Can anybody give me any advise?

Here is the picture in my mind:

        Production        - Production server which already have codes
            ↑             
         Staging          - New staging server, will install Trac too
         ↗↙ ↖↘          
  Developer1  Developer2  - Local development 

My question is, how should I start?

Here are some steps in my mind:

  1. do a git init in production server (is this safe?)
  2. clone the repo from production to staging server
  3. developers clone the repo from the staging to their local machine
  4. push files to the staging server after finish changing
  5. when staging is ready, push everything to the production

Does this work flow makes sense, or there are some better way to do it?

What if I only want to change one file?

Does origin/master has anything to do with it in this process??
Who is the origin? am I going to end up having multiple origins??

Also, when should a developer use branch in this case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美男兮 2024-10-02 15:37:58

最好仅对生产使用主分支,对暂存使用开发分支。每个开发人员应该创建本地分支来添加新功能,然后与开发分支合并。如果您是 git 新手,请尝试使用 - http://github.com/nvie/gitflow 还有一张描述 git 分支模型的好图片 - http://nvie.com /posts/a-successful-git-branching-model/

It's better to use master branch only for Production and development branch for Staging. Each developer should create local branch to add new features and then merge with development branch. If you're new to a git, try to use - http://github.com/nvie/gitflow There is also good picture describing git branching model - http://nvie.com/posts/a-successful-git-branching-model/

任谁 2024-10-02 15:37:58

您的建议看起来不错,但我不会让开发人员直接推送到登台服务器。相反,集成商应该仔细审查分支并将它们合并到主分支(或者开发分支,如果您按照 bUg 的建议使用 git flow 模型)。 *
同一个人会推送到临时服务器。

* 集成商:“作为集成商的相当核心的人物小组项目接收其他人所做的更改,对其进行审查和集成,然后发布结果供其他人使用......


1.在生产服务器中执行 git init (这安全吗?)

是的,它很安全,但是您当然必须对此存储库设置非常严格的权限。
如果我还没有本地磁盘,我可能会首先将整个网站curl到本地磁盘上。

2.将存储库从生产服务器克隆到登台服务器

您可能应该有一个与生产服务器和登台服务器分开的“中央”存储库。可以根据需要克隆并推送该文件。

3.开发人员将存储库从暂存区克隆到本地计算机

4。完成更改后将文件推送到登台服务器

5.当登台准备就绪时,将所有内容推送到生产中

将“登台”替换为“中央”,我认为你没问题,但更大的问题是如何使用分支和合并,正如 bug 指出的那样。

Your suggestion looks ok, but I wouldn't let the developers push directly to the staging server. Instead, an integrator should carefully review branches and incorporate them into the main branch (or development branch if you use the git flow model as suggested by bUg.) *
The same person would push to the staging server.

* Integrator: "A fairly central person acting as the integrator in a group project receives changes made by others, reviews and integrates them and publishes the result for others to use..."


1. do a git init in production server (is this safe?)

Yes it's safe, but you of course have to set very restrictive permissions on this repo.
I would probably start off by curling the whole web site to a local disc, if I don't already have it.

2. clone the repo from production to staging server

You should probably have a "central" repo separate from both the production and the staging server. That one can be cloned and pushed as needed.

3. developers clone the repo from the staging to their local machine

4. push files to the staging server after finish changing

5. when staging is ready, push everything to the production

Replace "staging" with "central" and I think you're ok, but a bigger issue is how you'll work with branches and merging, as bUg points out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文