Question

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?

Was it helpful?

Solution

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.

git init .

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:

git checkout -b rails-3

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:

git checkout master

Do the work, commit the modifications and then go back to Rails 3 branch and rebase:

git checkout rails-3 && git rebase master

After you're done and have a working Rails 3 app, go back and merge the changes:

git checkout master && git merge rails-3
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top