Open Source Contribution Workflow Best Practice

Open Source Contribution Workflow Best Practice
Photo by Praveen Thirumurugan / Unsplash

Generally speaking, as we were using some open-source libraries we will inevitably find that there are some bugs or points that can be improved. And sometimes we even have to develop a brand new feature based on these libraries to satisfy our own needs. Out of respect for sprit of dedication, contributing our code to these opensource libraries is a good way to give back to the community.

My Practice

When I decided to contribute to a repository, I will first try looking for if there is a contribution guide for it. Such guides usually lied as a section in the README or as a single document named CONTRIBUTING. Only when no guides were found, I will try to open a pull request to this repository on Github.

My Best Workflow

I'm using github.com/gorilla/mux as a sample repository to which I'm going to contribute. Here's my workflow:

  1. On GitHub

Fork the repo to my account, e.g. github.com/ggicci/mux

2. On local machine

# clone the repo
git clone git@github.com:gorilla/mux.git

# rename origin to upstream
git remote rename origin upstream

# add my forked repo as the origin remote
git remote add origin git@github.com:ggicci/mux.git

# make some changes to the source code and commit to origin
git add ...
git commit ...
git push origin ...

3. Back to GitHub

Open a pull request from ggicci to gorilla.