This year I authored several RubyGems and just this week finally learned how to work with a contributor.
Of course GitHub has the great Merge pull request option when an auto-merge is possible, and I use that quite often, but the workflow on OSS projects sometimes requires you to run the tests locally and make any modifications before merging it.
A quick search didn’t turn up any easy to read instructions, and I’m no git guru, so it took me a few minutes to figure out a simple workflow.
1. Clone my repo and create a feature branch
git clone email@example.com:jonmagic/ghee.git cd ghee git checkout -b repos_support master
This creates a new branch called repos_support, based off of master, and checks it out.
2. Pull contributors code into your local branch
git pull https://github.com/rauhryan/ghee.git repos_support
This pulls the repos_support branch from the remote repo and merges it into the branch you have checked out (which we also called repos_support).
3. Run tests, make modifications, commit changes
bundle exec rake touch OHNOES.txt git add OHNOES.txt git commit -m "Added OHNOES"
4. Checkout master, merge feature branch, push
git checkout master git merge repos_support git push
This workflow follows the kiss principle, so it worked quite well for me.
Please give me feedback. I would love to hear about how other people accomplish this task, so I encourage you to leave links/tips/tricks in the comments below.
posted December 30, 2011 by Hoyt