Contributing code, or even just text, like documentation, to a GitHub repository that isn’t yours is extremely easy. I’ve seen a lot of people including instructions in their GitHub readme files explaining how to contribute to the project. I included instructions in the Rootdip readme at the end of May 2013.
GitHub provides a list of trending repositories as well. There’s some really, really good stuff there, there’s been times that I’ve starred every trending repository for the current day. I only have 608 stars. You can see the trending repositories on the right side of the Trending repositories page.
So how the hell do I contribute?
First, find the repository you want to contribute to. Sounds obvious, but don’t contribute to a project that hasn’t been updated in 4 years, your contribution will never be integrated. For this example we’ll be adding a new navigation menu (it’s a website, but can be anything really) to the githubuser/the-project-name repository (it’s not real).
Here’s what you want to do
1. Fork the project
2. Clone your forked repo: git clone [email protected]:githubuser/the-project-name.git
3. Create your feature branch: git checkout -b new-menu
4. Make your changes, creating whatever new files you need as well
5. Commit your changes to your new branch: git commit -am ‘Add a new menu to replace that ugly one’
6. Push to the branch: git push origin new-menu
7. Create a new Pull Request!
To create a Pull Request, go to the original repo (ex: http://github.com/githubuser/the-project-name/). There should be a green “Compare and pull request” button (button image is below) that’s not typically there, click it! Enter your comments and wait for the repo owner to merge your branch or suggest some changes.
Remember, your pull request may never get merged, so make sure you contribute to an active project. I recently sent a pull request to wp-svbtle, but the project hasn’t been active for 3 months. I’m also not sure the repo owner will accept my change, because my addition certainly isn’t inline with the official svbtle.com.
Click that button and you’ll be taken to a form to enter a comment including details about your pull request. Fill out, submit the form, and you’re done. Congratulations! You just sent a pull request on GitHub! You’re almost guaranteed to find a project that you’d like to contribute to, so make use of the issue search functionality, or the advanced search if you’re so inclined. There’s currently 21.7 million issues and 9.8 million repositories!
For the curious here’s a few recent pull requests I’ve sent that are strictly text-based, no code involved. I think they’re quite easy for git beginners to get a decent grasp of how git works. And getting people involved in open source at some level is always good.
Did I mess something up? Tell me in the comments below, or on Hacker News. If there’s a better way that I should be doing this, I’d love to hear your suggestions.
Well, now what?
Work with Me
I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!
Leave some Feedback
Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. 😀