TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to contribute to an open source project on GitHub

433 pointsby vivaladavover 8 years ago

28 comments

jhchenover 8 years ago
This guide is heavy on the mechanical side and misses a lot of important substantive parts, if your goal is to add value to an open source project.<p>Don&#x27;t just create a fork, branch, and submit a PR without context. First, make sure the intent of your change is actually desired. Just because someone opened an Issue does not mean that it belongs in the project. Anyone in the world can open a Github Issue for any reason. Instead engage and discuss the Issue first and make sure it&#x27;s actually something the project wants.<p>Don&#x27;t just start writing code. Familiarize yourself with the codebase. This comes naturally if you are a user of the project, as you will naturally run into bugs or learn the software&#x27;s behaviors and as you discuss the Issue or features with maintainers. There are far fewer right ways to build a feature than possible ways.<p>Finally, understand that your contribution is not &quot;free&quot; for the project. It takes time and consideration to even look at your PR and even more to code review it. The more popular the project, the more true this is.
评论 #12882817 未加载
评论 #12882811 未加载
评论 #12884152 未加载
评论 #12882662 未加载
cslover 8 years ago
There is one very important tip that&#x27;s missing: Follow the original coding style <i>exactly</i>.<p>Not just spaces vs tabs or block styles, but idioms and other idiosyncrasies, too. Why? Imagine reading a source repo where every second block uses different bracket styles, mixing spaces with tabs and so on. It&#x27;s going to look like a kludgy mess, and will be distracting to read.<p>There <i>is</i> no correct style for most languages (perhaps `go fmt` might be an exception), only opinions.
评论 #12881650 未加载
评论 #12881916 未加载
评论 #12881306 未加载
评论 #12881685 未加载
brobinsonover 8 years ago
I dislike the idea of using &#x27;origin&#x27; for my own remote name.<p>I keep &#x27;origin&#x27; as the canonical remote and my local master branch tracks origin&#x2F;master. I use people&#x27;s usernames for their remotes (including for my own).<p>If I&#x27;m pushing a feature branch to my own remote:<p><pre><code> git push -u myusername mybranchname </code></pre> If I need to checkout someone&#x27;s PR, it&#x27;s:<p><pre><code> git remote add theirusername git@github.com:theirusername&#x2F;repo.git git fetch theirusername git checkout -t theirusername&#x2F;repo </code></pre> I&#x27;ve seen people at work who are new to git&#x2F;Github struggle a lot with the &#x27;origin&#x27;&#x2F;&#x27;upstream&#x27; differentiation recently, especially when they&#x27;re learning branching, and they don&#x27;t seem to have any problems once I switch them over to using &#x27;origin&#x27; + usernames.
评论 #12884896 未加载
评论 #12882337 未加载
评论 #12881405 未加载
评论 #12881191 未加载
mholtover 8 years ago
I just want to emphasize that if reviewers ask you to make changes to your pull request, it is not a rejection or lack of appreciation. As the maintainer of an open source project, I greatly value contributors who will iterate and iterate until the change is accepted, and often, I will give them push rights (&quot;collaborator&quot; status) to pay it forward.<p>And if a change is rejected, it&#x27;s usually because there was not enough discussion beforehand about how to solve the problem, the change itself did not undergo enough discussion&#x2F;iterations, or the change is not really a solution to a problem. (It&#x27;s not the maintainers saying &quot;Go away and never come back&quot; -- more like, &quot;Thank you for your effort! Please approach this differently.&quot;)
abanover 8 years ago
If you&#x27;d like to avoid switching to the browser in your development workflow, I recommend checking out Git-Repo [0] that was posted to HN a little while ago [1].<p>Git-Repo basically tries to put as many steps of the contribution workflow in terminal as possible, by using the API of the git hosting services. It currently supports GitHub, GitLab, and Bitbucket.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;guyzmo&#x2F;git-repo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;guyzmo&#x2F;git-repo</a><p>[1]: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12677870" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12677870</a>
hzooover 8 years ago
This is a great start!<p>Contributing can be a lot more than just PRs though: - answering questions on stack overflow, chat (irc, gitter, slack)<p>- creating a minimal code repro, checking for duplicates, checking if a bug is fixed in a later release&#x2F;master branch<p>- writing tutorials&#x2F;usage scenarios, giving talks, just using the project and providing feedback<p>- helping with documentation + website<p>- translations if possible<p>- reviewing other PRs<p>- helping with the changelog, testing prereleases<p>- adding to the discussion on issues<p>Bigger projects can have a pretty hard time with maintenance: fixing bugs, juggling PRs, making releases, answering questions, etc.<p>(We&#x27;re looking for help on <a href="https:&#x2F;&#x2F;github.com&#x2F;babel&#x2F;babel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;babel&#x2F;babel</a> and trying to figure out how we can make the project more contributor friendly!)
评论 #12881822 未加载
cthulhuologyover 8 years ago
For many projects, Github is just a place to publish yet another public repo. Using github issues and pull requests is a sure fire way to feel ignored. If you want to contribute, e-mail the lead maintainer. Do not submit patches to the ether. Do not think anyone will look at your patches. Having started several large open source projects, and started &#x2F; worked for a number of open source companies, I can tell you the best way to get involved is to work on your personal relationship with the other developers. If that means hanging out in IRC or Slack, that&#x27;s what it takes. Github is a terrible form of communication, especially when your org &#x2F; developers have 100+ repos.
评论 #12881905 未加载
评论 #12882146 未加载
评论 #12882647 未加载
atemerevover 8 years ago
Step 1: stumble upon a terrible bug (or that really obvious missing feature that _should_ be there) in your favorite library &#x2F; framework &#x2F; app.<p>Step 2: rant about it on HN &#x2F; Github issues &#x2F; whatever.<p>Step 3 (optional): try to reach developers on GitHub and get the obligatory &quot;pull requests are welcome&quot; response.<p>Step 4: In frustration, clone the repository, fix the damn bug and submit your pull request.<p>Steps 5..41: have an angry and emotional discussion with the devs who refuse to accept your PR because broken binary compatibility &#x2F; regression tests &#x2F; coding style &#x2F; your choice of variable names etc. Fix all these issues and resubmit the PR until it&#x27;s accepted.<p>Step 42: And this is how you become a contributor to high-profile projects like Docker, Akka, Spark etc, and now free to boast about it in your CV!
评论 #12881175 未加载
评论 #12881320 未加载
评论 #12882350 未加载
评论 #12882683 未加载
评论 #12881179 未加载
评论 #12881651 未加载
majelixover 8 years ago
Of these, 1: Chose the project you want to contribute to (and 1.5: Choose the issue to work on) and 9: Follow up are the hard ones. Both are primarily social problems.<p>For 1, it&#x27;s mostly about knowing yourself. What projects interest you, and where can you contribute?<p>For 9, it&#x27;s convincing the owners that your contribution is a net positive. Start with 2: Check out how to contribute, and proactively reach out so your pull request doesn&#x27;t come out of the blue.<p>Oh, and be willing to put your ego aside -- it can be tough to defend your work, particularly if you&#x27;re a new (and thus haven&#x27;t built up trust) contributor. It gets easier, both as the project learns to trust you and as you learn the work within their practices.
评论 #12881193 未加载
TAForObvReasonsover 8 years ago
&gt; The way people (usually) contribute to an open source project on GitHub is using pull requests.<p>I disagree with this premise. The way people usually contribute to an open source project on GitHub is creating an issue or adding to a discussion. IMHO this is more valuable than actually writing code because it helps other developers gauge the relative demand for a feature&#x2F;bugfix and sometimes you find out that other people have already solved the problem in their own forks.
chmikeover 8 years ago
There are a few steps missing. Before the push, we need to pull on master and rebase the branch on top of master. See triangular workflow in this page [<a href="https:&#x2F;&#x2F;github.com&#x2F;blog&#x2F;2042-git-2-5-including-multiple-worktrees-and-triangular-workflows" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;blog&#x2F;2042-git-2-5-including-multiple-work...</a>]
Whackbatover 8 years ago
For anyone that is new to contributing to projects using git for version control I strongly recommend giving this tutorial a read: <a href="https:&#x2F;&#x2F;www.atlassian.com&#x2F;git&#x2F;tutorials&#x2F;syncing" rel="nofollow">https:&#x2F;&#x2F;www.atlassian.com&#x2F;git&#x2F;tutorials&#x2F;syncing</a><p>Additionally, the best way to learn git is to use it so try all the examples.
fphilipeover 8 years ago
I can highly recommend hub [1], which does steps 3, 4, and 5 in one command:<p><pre><code> hub fork username&#x2F;repo </code></pre> 1: <a href="https:&#x2F;&#x2F;github.com&#x2F;github&#x2F;hub" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;github&#x2F;hub</a>
dibanezover 8 years ago
I&#x27;ve been doing this without thinking about it for a while and after reading it from a beginner&#x27;s perspective It seems like quite a few steps. It is the &quot;right&quot; thing to do though, as far as I know.
winterismuteover 8 years ago
Why did this get so many upvotes? It&#x27;s well written, but isn&#x27;t it just a trivial guide on how to do a pull request? Not trying to be controversial, I&#x27;m just genuinely curious.
tbarbugliover 8 years ago
I would add &quot;Make sure the maintainer of the repo will merge (or even look at) your PRs&quot;. I more than once had very reasonable PRs (bugfixes) waiting to be merged forever.
infodroidover 8 years ago
There is a lot of overlap with Github&#x27;s own guide to Contributing to Open Source [1] and Forking Projects [2]:<p>[1] <a href="https:&#x2F;&#x2F;guides.github.com&#x2F;activities&#x2F;contributing-to-open-source&#x2F;" rel="nofollow">https:&#x2F;&#x2F;guides.github.com&#x2F;activities&#x2F;contributing-to-open-so...</a> [2] <a href="https:&#x2F;&#x2F;guides.github.com&#x2F;activities&#x2F;forking&#x2F;" rel="nofollow">https:&#x2F;&#x2F;guides.github.com&#x2F;activities&#x2F;forking&#x2F;</a>
matiaszover 8 years ago
It’s amazing that there aren’t many articles like this one. I wrote something very similar [1] last year because I simply couldn’t find a complete, step-by-step guide that addressed the details of forking, branching, etc.<p>[1] <a href="http:&#x2F;&#x2F;www.matiasz.com&#x2F;2015&#x2F;04&#x2F;16&#x2F;contribute-open-source-repository-github&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.matiasz.com&#x2F;2015&#x2F;04&#x2F;16&#x2F;contribute-open-source-rep...</a>
exhilarationover 8 years ago
Is there a breakdown of top projects by language? I&#x27;m a C# developer and would love to put my skills to work on an open source project, but how do I find one?
评论 #12881317 未加载
评论 #12882019 未加载
评论 #12881417 未加载
joelhooksover 8 years ago
Here are some screencasts on this topic if that sort of thing interests you: <a href="https:&#x2F;&#x2F;egghead.io&#x2F;courses&#x2F;how-to-contribute-to-an-open-source-project-on-github" rel="nofollow">https:&#x2F;&#x2F;egghead.io&#x2F;courses&#x2F;how-to-contribute-to-an-open-sour...</a>
OhSoHumbleover 8 years ago
&gt; Hopefully some of the project mantainers will check your pull request and will give you feedback or notify you they decided to merge your changes soon.<p>Ah, my experience is that I&#x27;ll submit a PR and it&#x27;ll just be ignored until the end of time.
smegelover 8 years ago
7. Work on your contribution<p><i>8. Write tests!</i>
CharlesMerriam2over 8 years ago
Wow! When you want to fix a typo, it can be as little as two hours!
评论 #12882698 未加载
evantahlerover 8 years ago
Ya&#x27;ll can contribute to www.actionherojs.com whenever you want!
ThomPeteover 8 years ago
But what about designers?
评论 #12882646 未加载
评论 #12881295 未加载
dorianmover 8 years ago
Or in a lot of cases you can use github&#x27;s edit button ;)
评论 #12884819 未加载
awkward_yetiover 8 years ago
what if I want to start my contribution I just don&#x27;t know which project to choose ? this assumes that I already know the project I want to contribute to.
评论 #12881461 未加载
评论 #12882640 未加载
i9182u79ikjnskover 8 years ago
<i>Shudder</i>. This embodies all that is wrong with open source development these days.<p>Horrible GitHub workflow: corporate logos, octop^Hcat, CoC shoved in your face on every commit.<p>I&#x27;m currently forced to contribute to a GitHub project, it is the most annoying, bureaucratic and brainwashing workflow I&#x27;ve ever experienced.
评论 #12882260 未加载
评论 #12882147 未加载