如何在不冻结代码的情况下从 Rails 2 升级到 Rails 3?
我正在从 Rails 2 升级到 Rails 3。我所做的是克隆原始应用程序并开始升级过程。
不幸的是,我需要继续使用Rails 2并对其进行改进,因此代码发生了变化。
我还没有完成从原始代码到 Rails 3 的升级:我是否需要冻结当前的 Rails 2 然后重新开始,或者有什么方法可以将我的原始代码升级到 Rails 3,然后只进行所做的更改在原来的并将它们推入新的升级?
I am upgrading from Rails 2 to Rails 3. What I did was did a clone of the original app and began the upgrade process.
Unfortunately, I needed to continue to use and make refinements to Rails 2, so there have been changes in the code.
I am not done with the Rails 3 upgrade from the original code: do I need to freeze my current Rails 2 and then start-over, or is there a way I can get my original up to Rails 3 and then take only the changes made in the original and push them into the new upgrade?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会选择 git 来完成这种工作,它是一个很棒的工具。
首先,如果 git 存储库中没有源代码树,则可以将其初始化为 git 存储库。如果您已经在 git 中拥有它,您可以跳过这些步骤并跳转到分支创建。
使用 git add 添加源文件并使用 git commit 提交。
现在您在 git 中有一个可以运行的 Rails 2 应用程序,为您的 Rails 3 修改创建升级分支:
在这里您可以修改代码以使用 Rails 3。如果您需要修改 Rails 2 部分,只需签出到 master 分支:
完成工作,提交修改,然后返回 Rails 3 分支并变基:
完成工作并拥有一个工作的 Rails 3 应用程序后,返回并合并更改:
I would choose git for this kind of work, it is a beautiful tool for that.
First you can init your source tree as a git repository, if you did not have it in git repo. If you already have it in git you can skip these steps and jump to branch creating.
Add the source files with
git add
and commit it w/git commit
.Now you have a working Rails 2 app in git, create your upgrade branch for your Rails 3 modifications:
Here you can modify your code to work with Rails 3. If you ever need to modify the Rails 2 part, simply checkout to the master branch:
Do the work, commit the modifications and then go back to Rails 3 branch and rebase:
After you're done and have a working Rails 3 app, go back and merge the changes: