git 存储库到暂存站点到实时站点
我正在学习 git 及其基本原理。我有一个正在运行的 Magento 商店,需要尽快对其进行版本控制。我已经在我的工作机器上加载了 git,并尝试了设置存储库、添加、提交和推送文件。我已经使用 Assembla 和免费帐户(目前)测试了我的设置,一切都很好。
不过,我在身体变化方面仍然遇到困难。我想实现以下目标(我认为!):
- 从现场站点签出需要在本地计算机上使用的文件
- 在 Dreamweaver 中进行本地更改(我正在使用 GITweaver 并且可以轻松地与我的存储库进行通信)(另外,我不是如果有更好的解决方案,则反对更改文本编辑器/IDE)
- 将存储库推送到“暂存”站点以供审核和使用和我的伙伴一起测试。这就是我目前迷失的地方。将存储库发送到实时站点的过程是什么?
- 接受审核和更改后,将存储库推送到“实时”站点。
所以这里有几个重要的问题需要帮助。
- 您从实时站点还是暂存站点检出文件?有什么首选方法吗?
- 舞台网站是否应该始终反映实时网站?
- “开发”网站和“阶段”网站的目的是什么 - 它们不是相同的吗?
- 大多数人在这些设置中会做什么?为什么?我需要对阶段与开发进行良好的解释。
对我们的商店/项目有一些有用的背景:
- 我是唯一的开发人员,并且在一段时间内我可能仍将是唯一的开发人员
- 我使用 Windows 计算机进行开发,我们的托管是通过 HostGator
- 我的合作伙伴只需要查看舞台站点这样我们就可以一起查看更改,他不需要查看存储库。
如果有人能为像我这样的人指出指导教程或类似的教程,我会很高兴,因为我以前所有的事情都是倒着做的,现在没有时间一步一步地学习 git。
I'm just learning git and its basic fundamentals. I've got a live Magento store running and need to version control it asap. I've got git loaded on my work machine and have played around with setting up repositories, adding, committing and pushing files. I've tested my setup with Assembla and a free account (for now) and all is good.
I am still having trouble going about the physical changes though. I want to achieve the following (I think!):
- Checkout files needed from live site to work with on local machine
- Do changes locally from within Dreamweaver (I am using GITweaver and have that easily communicating with my repo) (Also, I am not opposed to changing text editors/IDE's if there is a better solution)
- Push repo to 'staging' site for review & testing with my partner. This is where I'm currently lost. What's the process of sending a repo to a live site?
- After review and changes are accepted, push repo to 'live' site.
So there's several important questions I need help with here.
- Do you checkout files from a live site or a stage site? Is there any preferred method?
- Is a stage site supposed to mirror a live site all the time?
- What is the purpose of a 'dev' site and a 'stage' site - aren't they the same?
- What do most people do in there setups and why? I need a good explanation of stage vs dev.
Some helpful background for our store/project:
- I am the only developer and I will probably remain the only developer for some time
- I am using a Windows machine to develop on and our hosting is through HostGator
- My partner will only need to see the stage site so we can look at changes together, he has no need to view the repository ever.
I would be thrilled if someone could point out a guided tutorial or similar for people like me who did everything backwards and now don't have the time to learn git one step at a time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Git 没有内置的工具。您需要编写一个脚本,定期(例如每五分钟)或按需从中央存储库中提取一些分支。 (我假设您在某处有一个具有此类功能的 Git 服务器。)
您可以对生产环境执行相同的操作,方法是让登台服务器拉取(例如
master
),并让生产环境服务器拉取分支生产
。Git does not have a facility for this built in. You'll want to write a script that periodically (say, every five minutes) or on demand pulls some branch from your central repo. (I'm assuming you have a Git server somewhere that functions as such.)
You can do the same thing for the production environment, by having the staging server pull, say,
master
, and having the production server pull the branchproduction
.@larsmans 为你提供了一些非常可靠的建议 - 我想我会涵盖你的其他观点来尝试帮助你。
将您的
dev
服务器视为您(可能还有其他开发人员)进行、测试和完成更改的地方。将阶段
服务器视为在其他利益相关者进入生产
或实时站点之前向他们展示潜在更改的地方。我个人为每个服务器使用一个分支(我们甚至在本地计算机进入
dev
/staging
之前将本地计算机指定为alpha
服务器),并且认为其中按层次结构:更改从 alpha 开始并向上合并 - 因此从 alpha 开始的错误修复被合并或樱桃挑选> 进入
dev
,检查,然后向上推送到stage
并最终推送到prod
。要更新,只需拉动
分支并以这种方式同步。每台服务器都有一个存储库的副本,在出现任何问题时提供额外的冗余。我们有自己的使用
gitolite
的 git 存储库,我们(轻松)定制了它来处理 @larsman 的答案中描述的push
和pull
职责- 不幸的是,由于您位于共享主机上,这可能不是您的理想解决方案。无论哪种方式,您都应该考虑运行 VPS,因为 Magento 非常消耗资源,并且加载时间会受到很大影响 - 这是尝试让 Magento 在 HostGator 上运行的人的第一手建议。@larsmans has some pretty solid advice for you - I figured I'd cover your other points to try to help you out.
Think of your
dev
server as where you (and possibly other developers) make, test, and finalize changes. Think of thestage
server as where you show potential changes to other stakeholders before they go to theproduction
or live site.I personally use a branch for each server (we even specify local machines as
alpha
servers before they even go todev
/staging
), and think of them hierarchically:Changes start in
alpha
and are merged upwards - so a bugfix that starts inalpha
is merged orcherry-picked
intodev
, checked, then pushed upwards tostage
and ultimately toprod
. To update, the branches are justpulled
and synced that way. Each server has a copy of the repo, giving extra redundancy in the case of any issues.We have our own git repository using
gitolite
, which we've (easily) customized to handle thepush
andpull
duties described in @larsman's answers - unfortunately, since you're on a shared host, this might not be the ideal solution for you. Either way, you should consider running a VPS, as Magento is very resource-intensive and load times suffer greatly - this is first hand advice from someone who has tried to make Magento work on HostGator.