Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 28, 2020 12:53 am GMT

Beginners Guide to Hacktoberfest

Contributing to open source is a great way to gain experience and confidence as a developer.

Anyone can create an open source project, but examples of major open source projects include Dev.to, Facebook's React.js, and Microsoft's VS Code.

Hacktoberfest is a great time to get started with open source because there are so many projects that are welcoming new developers.

get-started-gif

Table of Contents

Key Words:

what-does-that-mean-gif

let keywords={                                        git: "A version control system that tracks    file changes",Github: "A website that uses git to save and track coding    projects",Hacktoberfest: "A month long celebration of open source    hosted by DigitalOcean",maintainer: "The person that owns the upkeep and    communications for an open source project.",mergePullRequest: "When your contribution is approved,    the maintainer will merge or add your code to the    original project",openSource: "Publicly accessible code",pr: "PR, or pull request, is a request to add changes to    an existing code base.",repo: "A repo, or repository, is a code project"}

Find an Open Source Project

project-gif

For 2020, Hacktoberfest is requiring 4 open source contributions. Once you have found a repo you want to contribute to, make sure it meets the quality standards. Not sure where you want to contribute? There are several ways to find projects:

1) Search for some Hacktoberfest key words directly in GitHub (ex. Hacktoberfest, first-timers-only, beginner-friendly)

2) Contribute to an open source website or technology that you already use in your tech stack (i.e. Dev.to, Women who code, React.js)

Is this your first time ever making a pull request? I recommend getting comfortable with git by practicing on your own repo:

Practicing making a PR on your own code is a great way to learn the process with the assurance that you won't mess up anything.

1) Make a practice repo.

Practice repo

2) On your terminal, make a new directory for your practice repo and add a README file. This will act as our original project. Next, we'll make a pull request to add a new file to the original.

Run the following in your terminal:

mkdir pr-practice
cd pr-practice
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/*insert-your-github-username*/pr-practice.git
git push -u origin master

3) We now have our practice open-source project on GitHub. We are going to make a pull request to add a new Hello World file. In your terminal, run the following:

git checkout -b newbranch
git remote add upstream https://github.com/*insert-your-github-username*/pr-practice.git
touch HelloWorld.js
git add HelloWorld.js
git commit -m "Adds new Hello World file"
git push -u origin newbranch

4) Refresh the repo on GitHub and click "Compare and pull request."

Alt Text

5) Make sure that the base is your master branch (the original project with our README file) and the compare branch is the new brach we created with the Hello World file. The title of the merge request should be a brief description of the changes.

Alt Text

6) If there are no conflicts with your pull request, go ahead and merge the new code with your original project by clicking "Merge pull request" & "Confirm merge"

Alt Text

7) Congratulations! You have merged your new file.

alexis-rose-happy

How to make your first contribution for Hacktoberfest:

So, you're ready to make your first open source contribution (yay)!

There are a few extra steps you'll need to take when submitting a pull request on an open source project. Before you start writing code, make sure to sign up here so that you contributions count

1) Check out the repo's README to see if they have any syntax (style) standards that you need to follow. Click on the "issues" tab of the repo to get an idea of where you may be able to contribute.

2) Fork the repo: The first step is to "fork" or copy the current version of the project. When we fork a repo, we get a copy of the code that we can edit on our own computer without impacting the original code.

You can think of this like the "save a copy" feature in Excel. When someone sends you an excel file and it comes to you as read only, you have the option to edit the file. When you edit and save a copy of their original file, it is updated on your computer only.

fork-repo

2) Github will take you to your forked repo. Copy the link to the repo so that we can start coding:

Alt Text

3) In your terminal run the following using a directory-name that describes your project:

mkdir directory-name
cd directory-name
git clone copied-fork-repo-link
cd repo-name
git checkout -b newbranch
git git remote add upstream copied-fork-repo-link

4) Time to code!

5) When you are ready to commit your changes, go back to the terminal and run the following:

git add new-file-name (if applicable)
git commit -m "Description of your contribution"
git remote add origin copied-fork-repo-link
git push -u origin newbranch

6) Go back to your repo on Github. You should see the option to submit a pull request:

Example pr

5) Make sure that the base is the original repo and the compare branch is the new brach you created on your own repo. The title of the merge request should be a brief description of the changes. Click Create pull request to submit.

Example open source merge

6) Now we wait to hear from the maintainer! When it comes to making an open source contribution, you need to be aware that not all PR requests get approved. It is also common for the maintainer to send you some feedback of things you need to change before your contribution is merged.

done!

Disclaimer: Learning how to use the command line & learning how to use GitHub can be really challenging at first! The most important thing to remember is that pretty much any mistake you make can be reversed. Even for experienced devs, practice makes perfect when it comes to using GitHub.


Original Link: https://dev.to/tcgronk/beginners-guide-to-hacktoberfest-3m0m

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