17
Contributing to an Open Source project on GitHub Andy Waite June 2012

Contributing to Open Source via GitHub

  • Upload
    andyw8

  • View
    197

  • Download
    0

Embed Size (px)

Citation preview

Contributing to an Open Source project on GitHubAndy Waite June 2012

Why contribute?Learn a technology outside of your day job

Scratch an itch

Remove a blocker

Learn by peer review

Collaborate and share knowlege

Promote yourself and get noticed

Your portfolio is your CV

Coderwall

What to contribute?

Fix a bug for a problem you’ve discovered

Add behaviour for a new feature you want

Resolve an issue reported by someone else

Improve the documentation (what confused you?)

Expand the test coverage

Provide a example

The old way

Mailing lists, FTP servers

diff oldFile newFile > mods.diff

patch < mods.diff

SourceForge

The new way

GitHub - founded in 2008

Now over 1.7 million users, 3 million repos

Code, issues, wiki, hosting, stats, social, API

Major projects: Node, Rails, jQuery, Backbone, Linux Kernel, PHP, Zend 2, Symfony, Underscore, Git, Wordpress, Drupal

Big companies: Google, Microsoft, Apple

All free for public projects

Getting started

Create a GitHub account

Setup Git

Identify the original project (beware of forks)

Check for signs of life

Fork the original project

One click to fork into your account

andyw8/WidgetMagic → samfrench/WidgetMagic

Clones the full history, branches, tags

Clone your fork locally

git clone [email protected]:samfrench/WidgetMagic.git

cd WidgetMagic

Run the test suite

Install the dependencies

Run the test suite

Common language conventions:

Ruby: rake

Java: mvn

Create a topic branch

Use one branch per topic (bug, feature, etc.)

git checkout -b allow-duplicate-widgets

Display the current branch in your shell prompt

Commit your change

git add WidgetMagic.rb

git commit -m "Allow duplicate widgets"

Push to your remote repo

git push origin allow-duplicate-widgets

Create a pull request

Pull Request button appears on your repo

A pull request starts a conversation

It might not be accepted right away

Improve it and push the new commits

Merging the pull request

Project maintainer merges your commits and closes the pull request

GitHub sends you an notification

Your contribution shows in the commit log

Stay up-to-dateA few months later you want to contribute again

But changes to the original project don’t propogate automatically so your fork becomes out-of-date

git remote add upstream git://github.com/andyw8/WidgetMagic.git

git fetch upstream

get merge upstream master

Social coding

Promote your contribution

Maintainers - thank your contributors

In summary

Start with the smallest contribution you can find, e.g. fixing a typo

Share half-formed ideas. Code is better than words.

Start your own project!