DEV Community

Cover image for Contributing To Github Repository

Posted on

Contributing To Github Repository

This is the 3rd Week I've been in OSD 600. And obviously, I'm gonna have my Second Lab in this week. Fortunately, we don't need to create a new program or project to implement the Lab 2. Instead, we need to contribute on other people's program that from last 2 weeks. And we are going to update the program to be able to convert md file to html file as well. Also, we need to add one more feature for the md file conversion. It's more like a lab for us to help improve other people's program with actual code.

For this Lab 2, I wasn't able to find my partner until 2 days before the due date. At the beginning, I thought there must many people are looking for a partner. And I just need to catch up with them later.
However, the truth is even though I tried to find a partner on Tuesday, which is two days after the lab released, there is nobody looking for a partner anymore.
At that time, I realized that "time doesn't wait for anyone". If you need to do something, do it now. Stop procrastinating!!!
Due to I didn't have a partner to do this Lab 2, then I worked on my own code with the Lab 2 requirement. Just in case I can't find one, I could work on my own work!

Luckily, later on I found that my friend, Jiyun hasn't have a partner yet. So we decided to become each other's partners. After a few words of communication, we forked and cloned each other's repository at Github and then started to work on it.

Contributing on Github

The first step I did was I added an issue to Jiyun's repository so that she knows what I'm going to do with her code For this Lab 2, I'm going to implement the code that allows user covert a md file into a html file. Also, I would like add a feature that be able to change to header in MD file that with the # into the <h1></h1>.

And my next step was read through my partner's code. After _going through my partner's code, I tried to run it on my PC. However, when I tried to run the program by following the README file my partner provided, there was an error came up, like this:
Although, I didn't know the best way to solve this issue. I tried to use some different code to take place of the code style import that it's using. I changed it to:

let yargs = require('yargs/yargs');
let {hideBin} = require('yargs/helpers');
let fs = require('fs');
Enter fullscreen mode Exit fullscreen mode

And then deleted the line of "type": "module", in the package.json file.

Following Stuffs

Because my partner and I was using the same language to made this program, it was an easy job for me to understand her code. And then I just need to follow her logic to add a new feature to her code. By the way, I saw some of my classmates used the Regular expression to implement their work, but I'm not one of them. My feature is change the header in MD file that with the # into the <h1>. And the way I did that was to check if any line contains the symbol #. If there is one, just wrap the line within the <h1></h1>.
Lastly, I committed all the changes into the repository that I cloned from my partner and then Pull A Request.

My Feelings

This is not a very complicated Lab for me. But the steps that I was trying to implement it were really useful for me. I learned that how I can fork and clone other people's code. And I can modify them in a different branch after letting them know my purpose and my goal. When the modification things done, I just need to Pull A Request to the owner of the original repository. Telling them "Hey, this is what I had done, please check it out. And accept the pull request if you think it's useful for you." This is an excellent experience for me. It taught me a lot of amazing stuffs when it comes to contributing at Github.
I think I'm gonna love this kind of contribution!

Link to my request pull:[]
Link to the program I worked:[]

Top comments (0)