After releasing the first version of git-rails, Ron Damen created a clone of the repository and started improving on it. And I liked what he was doing, so now was the time to figure out how to get some of his changes back in to the master repo.
Here is the list of steps (and what they mean) to get his changes into the master branch on Gitorious.
First, define a remote branch to track his cloned repository
git remote add ron git://gitorious.org/git-rails/rons-mainline-clone.git
This adds this to .git/config:
[remote "ron"] url = git://gitorious.org/git-rails/rons-mainline-clone.git fetch = +refs/heads/*:refs/remotes/ron/*
Before doing the actual checkout, make sure you have nothing to commit in the current branch, then checkout a tracking branch:
git checkout -b ron/master
Now get the content from thre remote (remote “ron”, branch “master”)
git pull ron master
Once you’ve reached this point, it is easy to switch back and forth between branches
git checkout master git checkout ron/master
Next, I created a temporary branch to merge what I like from Ron (not needed really)
git branch merge-ron git status # does not switch branch! git checkout merge-ron
This could be used as a shortcut: checkout -b merge-ron
Merge only specific changes (obtained using git log in ron/master branch)
git cherry-pick dc3de57a073e24eeb398e0cacbe52340258e861b git cherry-pick 61579f92e1bfc95e582728011fcd21c79f08c3ae
Merge from merge-ron branch into local master
git checkout master git merge merge-ron
And finally, push to origin
git push origin
From now on, the only thing needed to get more changes from Ron is to pull changes into ron/master, cherry-pick changes and merge back into master. Sweet!