Skip to content
Tengzhen edited this page Sep 28, 2021 · 63 revisions

Lab 2

Due Date

Friday Sept 24 by Midnight.

Overview

This week we are going to practice contributing and submitting pull requests to other repos we don't own. This lab will help you gain experience doing the following:

  • forking and cloning other projects
  • creating branches to work on new features and fix bugs
  • working on code you didn't write, trying to maintain the original style and not break things
  • working with Markdown
  • creating pull requests
  • collaborating with other developers on GitHub
  • reviewing code changes
  • updating your pull requests to include fixes for review comments

Step 1. Pick a Project

Pick another student's SSG project from the Release 0.1 Submissions list. You can work on any project other than your own. Make sure no one else is working on this repo (one student per repo for this lab, please).

Step 2. Pick a Markdown Feature to Add

You are asked to add initial support for Markdown in your partner's static site generator. Markdown is a simple addition to plain text files that allows for document formatting and structure to be applied easily. It is much simpler than HTML, but supports many of the same features. This document was written in Markdown, which GitHub used to create the HTML you see in your browser.

You will make two changes to your partner's repo:

  1. Modify the file handling so that it supports both .txt files as well as .md (i.e., Markdown files). If the file extension is .txt, process the file exactly the same way it is done now (i.e., no changes). However, if the file extension is .md, add some extra processing (a new function, another class, a new module, etc. as makes sense) to parse one aspect of Markdown into HTML.
  2. Choose at least one of the Markdown syntax features for Italics, Bold, Heading 1, Heading 2, or a Link and implement it.

NOTE: please hand-code your Markdown support vs. adding an existing open source Markdown parser, library, or framework.

Step 3. File an Issue

Search through the existing Issues to make sure no one has filed an Issue for Markdown support yet. If there is one already, move on to another project repo. If there isn't, file an Issue to add Markdown support. Describe what you want to do, and mention that you'd like to work on this. Give enough information for the project owner to understand what you plan on doing, and give feedback about how they want it done.

Step 4. Fork, Clone, Branch

Fork the other student's project on GitHub, then clone your fork. Next, create a branch for your work. If you filed Issue #5, name your branch issue-5:

git checkout -b issue-5

Do all of your changes (i.e., all of your commits) on this branch.

Step 5. Write the Code

First, read the existing code. Get a sense of how it's organized (files, classes, functions), and make sure you can run it. If the code is broken before you begin making changes, it will be hard to test your work. If you're unclear about how something is written, ask the owner for tips. Remember, open source is a team sport. You don't need to struggle on your own in silence. Use the community to discuss your work and get help.

Once you understand the existing code, start making changes to the existing code in order to implement your Markdown support. Make sure you write your code as closely to the style of the original author as possible. Make it look like the same person wrote all the code. Pay attention to how they name things, how they do formatting, where they put things, etc.

Try to change as little as possible in the existing code. Don't start rewriting everything because you like a different style. Don't touch code that is unrelated to your changes. Don't fix bugs unrelated to your current work (that should be done in another issue, pull request, branch). Be focused! Touch only the code you need to in order to make your changes work. Write as little code as possible, while still making sure the feature works. NOTE: if you do find other bugs while you are working, feel free to file additional issues in the other student's repo.

As you work, commit changes to your issue branch. For example, you might start by adding support for .md files along with .txt. Once that's written, you should commit your code before proceeding further. Your commits should be small, and tell a story: "Get the first part working", "Get the second part working", etc.

Make sure your changes don't break the original code. Test, test, test, and test again. When you are satisfied that things are working, proceed to step 6.

Step 6. Update the Docs or Other files

Because your code is adding a feature, it's likely that you need to update other non-code files as well. For example, the docs will need to be updated with info about Markdown, as well as discussing how to use the particular bits of Markdown you added. There could be other files that need to be updated as well.

Making changes to a project often involves updating code, tests, dependencies, etc. Make sure you look for all the places you need to update things. Include all of these related changes in your branch.

Step 7. Create a Pull Request

When you're finished Steps 1-6, create a Pull Request. Start by pushing your branch to your fork on GitHub (i.e. your origin). Assuming you were working on a branch called issue-5:

git push origin issue-5

Obviously you should rename issue-5 to the correct branch name.

Follow these steps to create a Pull Request from your branch. Pay attention to the following:

  1. Pick the correct branch in your repo (e.g., issue-5 for you and master or main for the original repo). You want your work to get merged into the original project's master or main branch eventually
  2. Write a complete title for your pull request. For example, "Add initial support for Markdown"
  3. Write a complete description of what you did, including info that this Fixes #5 (or whatever Issue number you are fixing). GitHub will automatically link an Issue and Pull Request for you if you use the correct syntax. In your description, talk about what you changed in the code, how you did it, explain why you made certain choices, and discuss any problems you encountered or bugs you know about. Make sure the project owner can understand why and what you want to change with your pull request.

Step 8. Get Feedback and Update your Pull Request

Find the original repo's owner on Slack, and politely ask them to review your Pull Request. It is almost guaranteed that they will ask you to make changes (NOTE: if you are reviewing someone else's changes to your repo, please ask them to change something so they can practice this part, even if it's small).

When you are asked to make changes, go back to your code and make sure you are on the same branch that you submitted. For example, git checkout issue-5 to get on the issue-5 branch.

Edit the code to address the reviewer's comments. Make sure you deal with all of them! When you're done, add another commit to this branch:

git checkout issue-5
git add file1
git commit -m "Updating x, y, and z based on review feedback"
git push origin issue-5

Again, change issue-5 to whatever branch you are working on. Once you've done this, go back to the Pull Request on GitHub and leave a comment telling the reviewer you have completed all their changes, and what you did to accomplish them.

Repeat this cycle as many times as necessary for the project owner to Approve your changes and merge your work.

NOTE: if you are merging another student's work on your master/main branch, make sure you pull these changes into your local machine afterward (assuming you are working on the main branch):

git checkout main
git pull origin main

This will bring all of the new code changes into the repo on your local machine so that you can build on top of them.

Also, make sure the original Issue gets closed once the Pull Request is merged. It might have happened automatically, depending on whether or not the original issue included the text Fixes #5 (or whatever the issue number is) in the description.

Step 9. Write a Blog Post

Write a blog post about the process of contributing a code change to another project. In your post, include links to everything you discuss (e.g., the project repo, your issue, your pull request). Discuss what you did, the changes you made for your feature, and the process of getting your work accepted. What problems did you have? What did you learn? What would you do differently next time?

If your repo received a pull request, please also talk about what it was like to get a submission. How much did you need the author to change? How did that process go?

Submission

When you have completed all the requirements above, please add your details to the table below.

Name Blog Post (URL) Your PR (URL) PR(s) to Your Repo, if any (URL)
Example Name Post Name Tool Name, PR6 Tool Name, PR8
Minh Quan Nguyen https://dev.to/mqnguyen/getting-started-with-pull-requests-27j6 https://github.com/hlavu/my-ssg/pull/14 https://github.com/mqnguyen5/mini-ssg/pull/9
Japneet Singh Kalra https://dev.to/japneetsingh035/collaborating-with-other-developers-on-github-3242 https://github.com/sirinoks/SSGNode/pull/18 https://github.com/japneetsingh035/ModernSSG/pull/12
Tuan Thanh Tan https://dev.to/tuanthanh2067/issues-and-pull-requests-on-a-static-site-generator-written-in-javascript-182o https://github.com/minhhang107/mh-ssg/pull/7 https://github.com/tuanthanh2067/cv-ssg/pull/16
Ahmad Rokay https://dev.to/ar/lab-2-284l https://github.com/lmpham1/cool_ssg_generator/pull/11 https://github.com/a-rokay/static-site-generator/pull/6
Chi Kien Nguyen https://dev.to/kiennguyenchi/osd600-week-3-lab-2-2191 https://github.com/tcvan0707/txt2html/pull/8 https://github.com/kiennguyenchi/potato-generator/pull/4
James Mai https://dev.to/beamazedvariable/week-3-getting-comfort-and-a-bit-exciting-about-open-source-459p https://github.com/AndreWillomitzer/textToHTML_V2/pull/9 https://github.com/BeAmazedVariable/TS-SSG/pull/9
Thanh Cong Van https://dev.to/tcvan0707/first-experience-with-pull-request-p3o https://github.com/kiennguyenchi/potato-generator/pull/3 https://github.com/tcvan0707/txt2html/pull/8
Minh Hang Nguyen https://dev.to/minhhang107/collaboration-and-pull-requests-1o8p https://github.com/tuanthanh2067/cv-ssg/pull/16 https://github.com/minhhang107/mh-ssg/pull/7
Kunwarvir Dhillon https://dev.to/dhillonks/contributing-code-to-open-source-repositories-1cm9 https://github.com/ritikbheda/commandline-ssg/pull/9 https://github.com/dhillonks/cli-ssg/pull/10
Trang Nguyen https://tracy016.medium.com/osd600-working-with-other-students-source-code-4bf012378ca1 https://github.com/irenejoeunpark/ssgApplication/pull/11
Oliver Pham https://dev.to/oliverpham/3-things-i-learned-from-contributing-to-open-source-3lma https://github.com/ycechungAI/cmd-ssg/pull/25 https://github.com/oliver-pham/silkie/pull/12
Andre Willomitzer https://dev.to/andrewillomitzer/my-first-experience-with-pull-requests-and-merging-40eo https://github.com/BeAmazedVariable/TS-SSG/pull/8 https://github.com/AndreWillomitzer/textToHTML_V2/pull/9
Gus McCallum https://dev.to/gusmccallum/collab-bro-1fa3 https://github.com/joshuali7536/LennahSSG/pull/9 https://github.com/gusmccallum/GAS-ssg/pull/16
Luigi Zaccagnini https://dev.to/luigizaccagnini/contributing-to-open-source-with-adding-features-j90 https://github.com/drew5494/the-great-site-generator/pull/11 https://github.com/LuigiZaccagnini/octo/pull/8
Tuan Phong Nguyen https://blog.andrewnt.dev/post/osd-600-series-pull-request https://github.com/hphan9/shinny-ssg/pull/7 https://github.com/Andrewnt219/paper/pull/28
Vivian Vu https://dev.to/vivianvu/osd600-contributing-to-other-repo-ilk https://github.com/mqnguyen5/mini-ssg/pull/9 https://github.com/hlavu/my-ssg/pull/14
Kevan Yang https://dev.to/pandanoxes/lab-2-create-issue-and-pull-requests-4gkp https://github.com/DukeManh/OSD_SSG/pull/9 https://github.com/Kevan-Y/text-ssg/pull/16
Eugene Chung https://ycechung-opensource.blogspot.com/2021/09/osd600-lab-2-sharing-and-forking.html https://github.com/oliver-pham/silkie/pull/12 https://github.com/ycechungAI/cmd-ssg/pull/25
Leyang Yu https://dev.to/lyu4321/working-with-others-part-2-pull-requests-4o4m https://github.com/GMOTGIT/GMOT-SSG/pull/11 https://github.com/lyu4321/jellybean/pull/11
Le Minh Pham https://medium.com/@lmpham1/my-first-open-source-contribution-3ff418764df8 https://github.com/a-rokay/static-site-generator/pull/6 https://github.com/lmpham1/cool_ssg_generator/pull/11
Xiongye Jiang https://dev.to/derekjxy/contributing-to-github-repository-54li https://github.com/jjung99/a1-ssg/pull/3 https://github.com/DerekJxy/My-First-SSG/pull/20
Minsu Kim https://dev.to/mkim219/working-with-other-project-388o https://github.com/suhhee1011/suhheeKim_OSD_release0.1_create_ssg/pull/19 https://github.com/mkim219/kimchi-ssg/pull/9
Anatoliy Serputov https://medium.com/@aserputov/three-things-i-learned-doing-my-lab-2-for-open-source-course-ab3acd9489b9 https://github.com/MizuhoOkimoto/pajama-ssg/pull/15 https://github.com/aserputov/qck-ssg-final/pull/6
Jiyun Jung https://dev.to/jjung99/my-first-contribution-1jp4 https://github.com/DerekJxy/My-First-SSG/pull/20 https://github.com/jjung99/a1-ssg/pull/3
Gustavo Tavares My First Collaboration! Jellybean, PR11 GMOT-SSG, PR11
Roman Rezinkin https://dev.to/romanrezinkin/dps909-lab-2-blog-13j7 https://github.com/Antonio-Bennett/rssg/pull/9 https://github.com/roman-rezinkin/RomanStaticSG/pull/14
Hung Nguyen https://dev.to/nguyenhung15913/new-open-source-contribution-9k9 https://github.com/LuigiZaccagnini/octo/pull/8 https://github.com/nguyenhung15913/OSD600-SSG/pull/11
Joshua Li https://dev.to/jli/learning-to-make-pull-requests-25j https://github.com/gusmccallum/GAS-ssg/pull/16 https://github.com/joshuali7536/LennahSSG/pull/9
Francesco Menghi https://dev.to/menghif/initial-pull-requests-4d7h https://github.com/TueNguyen2911/tue-1st-ssg/pull/11 https://github.com/menghif/dodo-SSG/pull/12
Antonio Bennett https://dev.to/antoniobennett/the-world-of-pr-s-oca https://github.com/roman-rezinkin/RomanStaticSG/pull/14 https://github.com/Antonio-Bennett/rssg/pull/9
Jia Hua Zou https://medium.com/@jhzou/week3-intro-to-pull-request-b9e5dd3b6e2b https://github.com/juuuuuuun/jun-ssg/pull/11 https://github.com/JiaHua-Zou/Jia_SSG/pull/14
Tengzhen Zhao https://dev.to/yodacanada/open-source-lets-us-help-each-other-and-improve-together-pfp https://github.com/Loran-l/txt-to-html-converter/pull/9 https://github.com/Yoda-Canada/Magic-SSG/pull/8
Amasia Nalbandian It takes a village StaticSiteGenerator, PR15 static-site-generator, PR9
Tue Nguyen https://dev.to/tuenguyen2911_67/adding-markdown-parsing-to-ssg-9kn https://github.com/menghif/dodo-SSG/pull/12 https://github.com/TueNguyen2911/tue-1st-ssg/pull/11
Reza Poursafa https://medium.com/@rezapscodes/contributing-to-my-friends-static-site-generator-app-11605187c97c https://github.com/AmasiaNalbandian/static-site-generator/pull/9 https://github.com/Reza9472/StaticSiteGenerator/pull/15
Irene Park https://dev.to/irenejoeunpark/working-on-other-s-project-26mp https://github.com/dbelokon/glazed-donut/pull/7 https://github.com/irenejoeunpark/ssgApplication/pull/13, https://github.com/irenejoeunpark/ssgApplication/pull/10
Emily Phan https://dev.to/hphan9/first-pull-request-59ll https://github.com/nguyenhung15913/OSD600-SSG/pull/11 https://github.com/hphan9/shinny-ssg/pull/7
Ritik Bheda https://dev.to/ritikbheda/contributing-to-others-repo-4b56 https://github.com/dhillonks/cli-ssg/pull/10, https://github.com/dhillonks/cli-ssg/pull/11 https://github.com/ritikbheda/commandline-ssg/pull/9
Roxanne Lee https://medium.com/@Roxanne.Lee/first-pull-requests-69b6add696b5 https://github.com/abatomunkuev/static_site_generator/pull/9 https://github.com/rclee91/SiteGen/pull/10
Suhhee Kim https://dev.to/suhhee1011/pull-request-to-other-s-repository-2bhe https://github.com/mkim219/kimchi-ssg/pull/9 https://github.com/suhhee1011/suhheeKim_OSD_release0.1_create_ssg/pull/19
Diana Belokon https://dev.to/belokond/i-ve-got-a-cute-pr-3ai7 https://github.com/irenejoeunpark/ssgApplication/pull/13 https://github.com/dbelokon/glazed-donut/pull/7
Mizuho Okimoto https://dev.to/okimotomizuho/open-source-my-first-pull-request-1356 https://github.com/aserputov/qck-ssg-final/pull/6 https://github.com/MizuhoOkimoto/pajama-ssg/pull/15
Jun Song https://dev.to/juuuuuuun/osd600-week3-lab2-4gmp https://github.com/JiaHua-Zou/Jia_SSG/pull/14 https://github.com/juuuuuuun/jun-ssg/pull/11
Qiwen Yu https://dev.to/qiwenyu/experience-on-contributing-to-a-github-project-mk5 https://github.com/roman-rezinkin/RomanStaticSG/pull/17
Andrei Batomunkuev https://medium.com/@andreibatomunkuev/open-source-development-becoming-familiar-with-pull-requests-b5159cdfddef https://github.com/rclee91/SiteGen/pull/10 https://github.com/abatomunkuev/static_site_generator/pull/9
Gerardo Enrique Arriaga Rendon Writing My First Pull Request Markdown support for <h1> to <h6> N/A
Alex Romanova Wdym Swift is for apple??? ModernSSG, PR12 SSGNode, PR18
Andrew Tassone Collaborating and Contributing N/A Add initial support for Markdown
Duc Bui Manh (https://medium.com/@manhducdkcb/git-push-f-fe1d1869fea7) (https://github.com/Kevan-Y/text-ssg/pull/16) (https://github.com/DukeManh/OSD_SSG/pull/9)
Clone this wiki locally