Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 25, 2021 03:38 am GMT

Open Source: My first Pull Request

After I published an open source project which creates a static site generator(SSG), my second lab assignment was adding new features and making a Pull Request with my partner's same project. My partner, Anatoliy, also created a SSG in JavaScript and his way to convert text file(s) to HTML file(s) was organized and clear.

New features

There are 2 required features.

  1. Modify the file handling so that it supports both .txt files as well as .md, and parse one aspect of Markdown into HTML.
  2. Implement one of the Markdown syntax features for Italics, Bold, Heading1.

First of all, I used Fork on his GitHub repository, and cloned to my GitHub repository. Then, I cloned it to my local computer, and created a new branch for my work with this command git checkout -b issue-5.

Initial Thoughts

Last week, when I tested and reviewed his project, I thought I understood his way and the code structure. However, when I started trying to implement the new features, I hit a wall. I had to ask him to explain his way and he sent me some videos to explain!(It was at 2am! Thank you, my sweet friend)
I communicated with him and I finally implemented the new features by adding some functions for reading .md file, and used replace methods to replace to markdown. Unfortunately, I had another problem. I installed Prettier on my local machine globally, so when I type ** to make the line bold, it became -or \*, so I couldn't test the implementations.

Making a Pull Request

After I finished the implementations, I made a pull request on my fork repository.
image
On my terminal, I changed the branch to issue-5, added the JavaScript file and updated README.md, committed, and pushed to the issue-5.
I posted a comment what I implemented with a sample on GitHub, and asked him to review and merge it.

Receiving a Pull Request

I received a pull request from Anatoliy, and I found a problem. After he Fork my repository, I updated my project, so there were some conflicts. I was afraid I would lose my updates when I merged his code, so I asked my professor and he worked me through how to merge.

How I merged and rebased

First, I cloned my project's repository on my local computer, and checked with git status. It showed Your branch is up to date with 'origin/main'. Then, viewing git remote configurations($git remote), and added Anatoliy's repository and named it anatoliy($git remote add anatoliy https://github.com/aserputov/pajama-ssg.git). After I added his repository, I checked remote configuration again, it showed anatoliyorigin. So I downloaded the commits, files, and refs from a remote repository into my local repo($git fetch anatoliy), and checked the past commits.
image
Then, I went back to my main branch($git checkout main), and merged issue-5($git merge issue-5).
image
I had some unmerged files, so I opened a pull request and filed changes on GitHub, so I could check what I should or shouldn't merge. For Example: $ git rm .\.DS_Storeand $git add README.md
After I committed it ($git commit without message), I checked with $git log, and I could see that I finally merged everything.
image

Closing a Pull Request

My professor taught me how to send a request change based on the pull request. First, inside the pull request page, I clicked the "View changes" button, checked the changes, then made a Review changes and submitted.
image

Conclusion:
I didn't like Git before, because it's complicated and I always get a bunch of error messages. However, after I watched my professor's lectures and through this assignment, I'm getting to like it. I feel like Git is magic It was great to collaborate with my partner and get support from my professor.
I still have some issues to improve my project, so I will update it soon


Original Link: https://dev.to/okimotomizuho/open-source-my-first-pull-request-1356

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To