DEV Community

Thanh Van
Thanh Van

Posted on

First experience with Pull Request

This is my third week get along with open source, and I realize that there are so much fun if we are not working alone. At first, I thought it was really hard to work and develop on someone's program until I give it a shot. Let me walk you through what I have done for this week.

This is actually my first time working with Pull Request, and once again I choose Kien Nguyen as my partner for this lab. Based on the previous lab, I have noticed how he writes his program, as well as being familiar with the structure of Kien's program.I also check his repo to see if he would make any changes in his code. And this time, I would love to add Markdown Support Feature in his program. More specifically, I will make some adjustments to process .md file and implement Markdown syntax for Heading 1. This time, I have to be extra careful when modifying his code, I am trying to make less changes as much as possible ^!^. Let see how I make changes to his code in order to support Markdown file mentioned above.

At first, if I want to process .md file, I have to make the program accpept it and then being able to open it. So, in his pgprogram.cpp file, I create a new variable named mdFile, then I create another if/else statement inside the main function to accept .md file. Another change is inside his HTMLFile.cpp file, I modify his setHtmlBody function to support making Heading 1. At this point, another if/else statement being used again to find the syntax # and replace it with the <h1> tag. I use method find() to look for the syntax #, and then using method erase() to delete it, then adding <h1> tag to the place where I delete the #.

After modifying his code, I create a pull request and politely ask Kien to review it and let me know if he has any questions. We were having a long conversation discussing about the new feature between my pull request and his. After all, I have reviewed his pull request and I also make some changes based on his pull request for my program, everything works as exactly what we expect.

Overall, do not think you are not good enough to contribute to someone else's program. You are not alone, we are here to learn, there are so many things in IT fields for you to learn everyday. Contributing to other's code will allow you to explore new stuffs, understanding different logic as well as the way they write their program. Github is a wonderful place for you when you want to be part of other's project. Let help us become better ^^.

Top comments (0)