简体   繁体   English

使用Git进行Magento升级

[英]Magento upgrading with Git

I am about to upgrade our Magento store from 1.5.0 to 1.6.0, I know how I want to do it, but I'm a little unsure on the commands I needs to use. 我对我们的Magento商店升级从1.5.0到1.6.0,我知道我怎么做,但我对我需要使用命令有点不确定。

For starters I have my current store on our production server, I have git setup and a duplicate of the repo is on our Beanstalk account. 首先,我在生产服务器上有当前存储,有git设置,并且回购的副本在我们的Beanstalk帐户中。 I have a full history of changes etc. within that repo and would ideally like to keep those in place. 我在该回购中拥有更改等的完整历史记录,并且理想情况下希望将这些更改保留在原位。

I have a theme that we purchased and then quite heavily optimised but thankfully almost all optimisations are within an override.css file. 我购买了一个主题,然后对其进行了相当大的优化,但是值得庆幸的是,几乎所有的优化都在override.css文件中。 Although, there are a few minor code changes within the theme files themselves. 虽然,主题文件本身有一些小的代码更改。

As Magento use SVN as their CVS I have found (on Github) a mirror of Magento releases. 当Magento使用SVN作为其CVS时,我在Github上发现了Magento发布的镜像。

So, so far I have three locations that I would like to 'merge': 因此,到目前为止,我有三个要合并的位置:

  1. Production (git) 产量(吉特)
  2. Magento mirror (git) Magento镜子(git)
  3. Theme (not git or svn, plain old directories) 主题(非git或svn,普通的旧目录)

I was thinking of adding the Magento mirror as a branch to my existing git repo, calling it 1.6.0 or similar. 我当时正在考虑将Magento镜像作为分支添加到我现有的git repo中,称为1.6.0或类似版本。 Then somehow pulling the plain theme directories and file into the master branch... 然后以某种方式将普通主题目录和文件拉入master分支...

Am I on the right lines? 我在正确的路线上吗?

I was also thinking, to protect the production site, of adding a staging version of the website to run these merges on to test them. 我还考虑过,为了保护生产站点,添加网站的暂存版本以对这些合并进行测试。

It's rather easy but you have to ensure that your site is based on some master repo that can be merged down the stream with earlier versions (repo that has all Magento versions as tags or branches that can be merged to latest from first). 这很容易,但是您必须确保您的站点基于可以在流中与早期版本合并的主存储库(具有所有Magento版本作为标记或分支的存储库,可以从一开始就合并到最新版本)。 So here's two scenarios to follow 所以这是两种情况

1. My site is not in git 1.我的网站不在git中

  1. start by cloning from master repo that has all magento versions (at least to the version you are currently using) 首先从具有所有magento版本(至少到您当前使用的版本)的主存储库中进行克隆
  2. get your clone and checkout new branch with the version you are currently using 获取克隆并使用当前使用的版本签出新分支
  3. copy over your current site to this version 将您当前的网站复制到此版本
  4. after that done "git status" will show you the diff with original version you started with and all the edits you have made to it 完成后,“ git status”将向您显示开始时使用的原始版本的差异以及对它所做的所有编辑
  5. its now smart to move all core edits to local codepool and revert any changes in core to original files, move any edts in default or base templates to your own template and revert changes in default or base template files. 它现在很聪明,可以将所有核心编辑移至本地代码池,并将核心中的所有更改还原为原始文件,将默认模板或基本模板中的所有edts移至您自己的模板,并还原默认或基本模板文件中的更改。 Same goes with all the files that look modified against the original version. 对原始版本进行了修改的所有文件也是如此。 This gives you "all my changes are separate from original code and they will not conflict my upgrades", it's wise to commit this state 这使您“我的所有更改都与原始代码分开,它们不会与我的升级冲突”,明智的做法是提交此状态
  6. If all things are separated from original files then it's time to upgrade. 如果所有内容都与原始文件分开,那么该进行升级了。 Turn on default theme, disable all local and community extensions , merge the new version with your current branch. 打开默认主题,禁用所有本地和社区扩展,将新版本与当前分支合并。 Visit the site to perform the upgrade 访问该站点以执行升级
  7. Now your site is upgraded and you can turn on your theme and custom extensions one by one to see what is compatible and what not. 现在,您的网站已升级,您可以一个个打开主题和自定义扩展,以查看兼容和不兼容。 Debug and solve one by one 一对一调试和解决

My site is already in git 我的网站已经在git中

  1. if it is based on repo that has all versions you are in good condition (skip 2) 如果它基于具有所有版本的仓库,则您的状态良好(跳过2)
  2. if it's not then you can add some repo that has it all as your remote and start with merging your current version and separating changes from original like described in first scenario 如果不是,那么您可以添加一些具有全部功能的仓库作为遥控器,并从合并当前版本并将更改与原始版本分开,如第一种情况中所述
  3. make a new branch of your current site used 使用您当前站点的新分支
  4. merge with new version 与新版本合并
  5. disable all local, community extensions, turn on default theme, and upgrade 禁用所有本地,社区扩展,打开默认主题并升级
  6. enable theme, extensions one by one and debug where conflicts happen 启用主题,一个接一个地扩展,并调试发生冲突的位置

It's common to have a git setup like follows: 像下面这样设置git是很常见的:

  • MAGENTO MASTER -> REMOTE ORIGN THAT HAS ALL MAGENTO VERSIONS MAGENTO MASTER->具有所有MAGENTO版本的远程原始版本

  • YOUR MASTER -> REMOTE ORIGIN IS MAGENTO MASTER 您的大师->远程起源是MAGENTO大师

    • branch: yoursite_dev 分支:yoursite_dev
    • branch: yoursite_stage 分支:yoursite_stage
    • branch: yoursite_live 分支:yoursite_live

You always develop on your_dev branch andif changes are ready for evaluation you merge _stage with _dev and if changes are approved you merge the state to _live either from _dev or from _stage. 您总是在your_dev分支上进行开发,如果准备好进行评估以将_stage与_dev合并,并且如果批准了更改,则可以将状态从_dev或_stage合并到_live。

commands based on theoretical endpoints 基于理论终点的命令

git clone git://github.com/speedupmate/Magento-CE-Mirror.git yourprojectdir 
cd yourprojectdir
git fetch --tags
git tag
git checkout -b yoursite_dev magento-1.5.0.1
git checkout -b yoursite_stage yoursite_dev
git checkout -b yoursite_live yoursite_dev
git checkout yoursite_dev
git branch
//copy in your site
//separate changes or originals
//add any file/dir with local importance to .gitignore
//turn of your default theme, disable all local/community extensions and overrides
//assuming you are on dev branch commit your clean state 
git merge magento-1.6.0.0
//visit the site to execute the upgrade 
//enable your theme , extensions , debug

this gives you a starting point for scenario 1 and after that you could just copy in your site and start separating changes and making order in your current site and themes 这为您提供了方案1的起点,之后您可以复制您的站点并开始分离更改并按当前站点和主题进行排序

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

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