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 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:
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.
To participate, there are a few things you need to do
With those two steps done, you can start looking for repositories that would benefit from your help.
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).
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:
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 fork
ing the repo.
fork
button in the upper right hand corner of the pageThis will create a copy of the repo on the server, owned by you, to which you can eventually push
any changes you make.
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 clone
ing 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.
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
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).
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.
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).
Finally, it’s time to submit the pull request to the original repo via our forked repo.
https://github.com/YOUR_USERNAME/Hacktoberfest-Census
branch: Master
and change it to the branch used earlier (mine was add-epi
)New pull request
,Create pull request
buttonAt 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.
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.
If you’re interested in some of the other pull requests I submitted, you can view them here.
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!