本地/暂存/生产服务器堆栈 + Git 的最佳工作流程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19882277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Optimal workflow for Local / Staging / Production server stack + Git
提问by Prefix
I am looking to incorporate a web development workflow that allows me to do the following:
我希望合并一个 Web 开发工作流程,它允许我执行以下操作:
- Develop / Test locally
- mimics production server (many subdomains, a few mysql DBs)
- stays synced between desktop & laptop to allow on-the-go development
- easily push local -> staging
- easily push staging -> production
- easily live-edit on the production server (occasionally need to for very minor content updates, typo changes, etc. Right now I spend a lot of time making small edits, pushing it to staging, then pushing to production which takes awhile for minor things.)
- 在本地开发/测试
- 模拟生产服务器(许多子域,一些 mysql 数据库)
- 在台式机和笔记本电脑之间保持同步,以便进行移动开发
- 轻松推送本地 -> 分期
- 轻松推动分期 -> 生产
- 在生产服务器上轻松进行实时编辑(偶尔需要进行非常小的内容更新、错别字更改等。现在我花了很多时间进行小的编辑,将其推送到暂存,然后推送到生产,这需要一段时间来处理小事情.)
I am also new to Git. I have begun test the waters with Git in my personal projects, however the project I have inherited (with the production/staging environments) has not used any version control to this point.
我也是 Git 的新手。我已经开始在我的个人项目中使用 Git 试水,但是我继承的项目(带有生产/暂存环境)到目前为止还没有使用任何版本控制。
Questions:
问题:
- how can I easily adapt a large established project to a local environment (XAMPP)?
- how can I sync my local environment between dev-laptop and dev-desktop?
- Is Github worth it in this type of pre-established project / server setup? It seems like it adds a lot more steps (ex: local->push to git repo -> download repo to staging server -> push staging server to live server). Also I am concerned about maintaining privacy/security.
- 我如何轻松地将大型项目适应当地环境 (XAMPP)?
- 如何在 dev-laptop 和 dev-desktop 之间同步我的本地环境?
- 在这种预先建立的项目/服务器设置中,Github 值得吗?似乎它增加了更多的步骤(例如:本地->推送到 git repo -> 下载 repo 到登台服务器 -> 将登台服务器推送到实时服务器)。我也担心维护隐私/安全。
essentially I'm the single developer who was handed a fairly large project and I just want to try and make things as easy/straightforward on myself as possible. :)
本质上,我是一个接到一个相当大的项目的单一开发人员,我只想尝试让自己尽可能简单/直接。:)
采纳答案by Florian von Stosch
Branches are one way to facilitate this workflow. There is a great blog postabout how to use Git branches to manage a typical development workflow.
分支是促进此工作流程的一种方式。有一篇很棒的博客文章介绍了如何使用 Git 分支来管理典型的开发工作流程。
You would then have one branch for production (e.g. master
), one for the live-edits which correspondes to the hotfix
branch in the post above, and another one for development.
然后,您将有一个用于生产的分支(例如master
),一个用于与hotfix
上面帖子中的分支相对应的实时编辑,另一个用于开发。
To sync your local environments on laptop and desktop, you can use the aforementioned development
branch also as a remote branch and have both devices push their local commits on this branch to the remote repository.
要在笔记本电脑和台式机上同步本地环境,您也可以将上述development
分支用作远程分支,并让两台设备将其在此分支上的本地提交推送到远程存储库。