Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 21, 2020 02:24 pm GMT

Contributing To An Open Source by A First-Timer (Part 1)

Hello Fellow Codenewbies

If you are self-taught, maybe you have a similar experience as mine.
As a self-taught, I only use "git" to push my own project to my own repository.

Also, other than the default (main) branch, I never create any other branch to work with.
I always create solo projects. And my naive thought says, 'I don't see the need of creating another branch because I will push my changes directly to my main branch'.

There Would Be A First Time For Everything

I never have thought of taking part in Hacktoberfest or contributing to any open-source out there simply because the idea of doing one is too overwhelming and I don't see many beginner-friendly repos for me to contribute to.

But this year - thanks to my beautiful community Virtual Coffee - I got the experience to contribute to its open-source.
( Special thanks to Dan Ott for the clear written instructions and Mike Rogers for helping me out executing one when I was shaking!)

From Forking Until Committing

  • Fork a repo
    Open the repo that we want to clone and click the fork button on the top right.

  • Clone the repo

    • Click the green "Code" button and copy the HTTPS URL
    • In the terminal, navigate to the location where we want to store the repo.

        cd new-project-storage
    • Now it's time to use this command to clone the repo.
      Paste the copied HTTPS URL as repo-url

        git clone <repo-url>
  • Create a new branch

This branch would be our working branch where we will commit our changes and the branch that we push later on to the repo.

git branch <branch-name>
Enter fullscreen mode Exit fullscreen mode

This is to make sure that we are in the branch where we will make changes before we work on it so we don't accidentally push our changes to the main branch.

  git checkout <branch-name>
Enter fullscreen mode Exit fullscreen mode

Additional Note

There is a shortcut to create a branch and navigate it automatically to the new branch:

  git checkout -b <branch-name>
Enter fullscreen mode Exit fullscreen mode

After we finish working on our changes let's add them to the staging area.

git add .
Enter fullscreen mode Exit fullscreen mode

Then commit the changes.

git commit -m "The message of our changes"
Enter fullscreen mode Exit fullscreen mode

We're done with all the steps from forking the repo until committing our changes.

Now let's take a coffee break before we continue to create the Pull Request, which I will continue in the next post.

Reminder

Don't push our changes before reading the next post!

Note:
This post is one of my TIL notes based on my experience contributing to Virtual Coffee's open-source.


Original Link: https://dev.to/adiatiayu/contributing-to-an-open-source-by-a-first-timer-part-1-2opa

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