Blog


Hacktoberfest 2018 - First Time Participant

Oct 7, 2018 | 5 minutes read

Tags: hacktoberfest, python, git

I recently had a co-worker ask me if I was doing any of those *insert-thing*toberfest challenges this year. He’s an artist and is doing inktober. Noone wants to see my attempts at inktober, but his question did prompt me to find out that there is an annual challenge for open source development called Hacktoberfest.


Hacktoberfest Overview

Hacktoberfest is in its fifth year and is put on annually by Digital Ocean. The tag line is pretty captivating

Support open source and earn a limited edition T-shirt.

I think we can all get behind a free t-shirt.

Aside from the shirt, there are associated values listed on the website, and they’re pretty awesome. They basically boil down to:

  • Everyone is welcome to participate
  • Participation leads to personal/professional/community growth
  • Short term actions have long term impact

The Rules

The rules for getting a t-shirt are pretty simple. Be one of the first 50,000 people to submit 5 pull requests on GitHub between Oct 1 and Oct 31.

Registration

To participate, there are a few things you need to do

  1. Create a github account
  2. Link your github account to Hacktoberfest

With those two steps done, you can start looking for repositories that would benefit from your help.

Getting Started

I’ve been writing Python for about 6 years now and use git regularly for my personal projects. I’ve never contributed to open source projects, mainly because it seemed daunting. By participating, I found out that the barrier for entry into making open source contributions is incredibly low (basically non-existent).

Hello Pull Request World

My first Pull Request was to Hacktoberfest-Census. There are a couple of these repos out there that essentially walk you through submitting a pull request with very clear cut things to include. Completing one of these first seemed like a good idea to get my feet wet.

We’ll examine the general steps for making a pull request using Hacktoberfest-Census:

Fork the Project

Because we are not registered as a collaborator for this specific project, we need to create our own copy of the repository on the github server. We can accomplish this by forking the repo.

  • Login to GitHub and go to the website’s repo
  • Click on the fork button in the upper right hand corner of the page

This will create a copy of the repo on the server, owned by you, to which you can eventually push any changes you make.

Clone the Fork

Now we have our own fork of the project that lives on GitHub’s server, the next step is to create a local copy of our repo that we can work with. This is done by cloneing the repo.

  • git clone https://github.com/YOUR_USERNAME/Hacktoberfest-Census.git

After running the command above, we have a local directory named Hacktoberfest-Census. This is our local copy where all of our work will be done.

Add Upstream Remote

When a repo is cloned, it has a default remote called origin that points to our fork on GitHub, not the original repo it was forked from. To keep track of the original repo, we need to add another remote named upstream.

  • cd Hacktoberfest-Census
  • In your broswer; go back to the original repo’s website and click on Clone or download and grab the URL, we’ll add this an another remote in our local instance.
  • git remote add upstream https://github.com/Cutwell/Hacktoberfest-Census.git
  • git fetch upstream
  • git merge upstream/master master

Now your repo knows about its origin (our copy of the repo) and the upstream (the original repo).

Do Work

Now we’re ready to actually do the work we set out to do in the first place. The Hacktoberfest-Census repo outlines what should be done to become a part of the census, i.e. how to contribute.

Fork this project and add your username + profile link to the Census list below, then make a pull request to add your name to this repository like so: [Cutwell](https://github.com/Cutwell)

Armed with instructions on how to contribute, in our local copy of the repo, we create a new branch

git checkout -b add-epi

and edit README.md to include a line like this

[epi](https://github.com/epi052)

You can check out my commit making my version of this change here.

Commit Changes to origin

With our work complete, it’s time to modify our copy of the repo.

  • git add README.md
  • git commit -m "Added epi"
  • git push origin add-epi

This will push our changed README.md to the origin (our repo).

Submit the Pull Request

Finally, it’s time to submit the pull request to the original repo via our forked repo.

  • In your browser, navigate to the forked repo https://github.com/YOUR_USERNAME/Hacktoberfest-Census
  • Click the dropdown labeled branch: Master and change it to the branch used earlier (mine was add-epi)
  • Beside the branch button, click New pull request,
  • Fill out the title and description with the relevant information
  • Click the Create pull request button

At this point the owner of the project can either accept your changes or not. In the case of this particular repository, we’re not really fixing anything, so changes should be accepted without any hassle. In a more complex project, your code may cause complications or problems that the project owner will want you to address before accepting your pull request.

Checking Hacktoberfest Status

While I was looking for projects to contribute to, I came across a cool project that allows you to check your Hacktoberfest progress. Just enter your GitHub username and you can see a nice summary of your pull requests.

hacktoberfest-checker-epi

If you’re interested in some of the other pull requests I submitted, you can view them here.

Closing Thoughts

Overall, I really like the idea of fostering open source community growth. I stumbled across a few very cool projects I had never heard of and got to write some code that will hopefully benefit others. The next time I come across some code that needs a little love, I know the process to get the fix in place. Also, free t-shirt!


comments powered by Disqus