One place for hosting & domains

      Submit

      Hacktoberfest: How to Submit Your First Pull Request on Github


      Introduction

      Hacktoberfest is a month-long celebration of open source software, run by DigitalOcean and open to everyone in our global community. To participate, you’ll need to submit four quality pull requests to public GitHub repositories in the month of October. Upon completing the challenge, you’ll earn special prizes, including an exclusive Hacktoberfest t-shirt.

      You can sign up anytime between October 1 and October 31, and we encourage you to connect with other developers and Hacktoberfest enthusiasts for virtual events and information sessions, starting in September.

      In this tutorial we’ll introduce you to Git, the version control system that you’ll use to submit your pull request, and Github, the repository hosting service that we’ll be using to track your progress. By the end of this tutorial, you’ll be ready to submit your first pull request and will be well on your way to participating in Hacktoberfest!

      Version Control

      Before we begin with Git and Github, let’s talk about version control. When developers work on a project together, oftentimes they’ll need to work on the same code base. While they’re working, each developer needs to know about what changes the other developer made, so as not to duplicate work or write code over what has already been done.

      A version control system serves as a saving program for code, where it assigns a version to a project and tracks changes made over time to each file in the project. In this way, developers can work together on a project by checking in with the latest version, to see the changes made before working on their portion of the project’s code.

      Git and Github

      Git, a version control system used to manage developer projects of all sizes, was created in 2005 by Linus Torvalds, the creator of Linux, to help developers contribute code and share code revisions in a way that was fast, efficient, and inexpensive. Git enables developers to edit, share, and publish code, facilitating collaboration and teamwork.

      Github is a cloud-based git repository hosting service that allows developers to take code that they’ve written on their local machines and share it with the world. It provides a way to share the version-tracked projects on your local computer publicly through repositories, or central file storage locations, and depending on the project’s availability (it can be either a public or private repository), other developers can download the project to edit the code, provide insight, and more.

      To get started with Github, you can create an account at Github. For more details on how to do that, please refer to the Hacktoberfest resources page.

      Cloning a Repository

      We’ll now clone and edit our first Github repository. First, let’s navigate to the repository that we’d like to clone. For the sake of this tutorial, we’ll use the Cloud Haiku repository.
      Before you clone this repository, that is, take a copy of the code on Github onto your local machine, you’ll need to take a copy of the whole repository into your own Github account. This is called a fork of the repository, and it allows you to develop your code without affecting the main code base.

      To fork a repository, click the Fork button at the top right in the repository. To clone, click the code button, take a copy of the link provided, then watch as Github takes this repository and adds it as a copy to your account. Your name should now appear as the creator of this repository, which is a ‘fork’ of the main haiku repository.

      Clone the repository

      Next, navigate to your command line interface to clone the project on your local machine.You can do that with the git clone command, which will clone, or copy, the fork that I just created from the haiku repository down to my local machine. This will enable you to make changes to the codebase locally (on your own machine).

      • cd ~
      • git clone https://github.com/sammy/cloud_haiku

      Editing Code Content

      You now have a copy of the Cloud Haiku repository on your local machine, so you’re ready to prepare your contribution. Using the command line interface, navigate to the folder of your cloned repository. If you followed along, you should have a cloud_haiku folder inside your home directory:

      There’s a number of text editors and Integrated Development Environments (IDEs) that you can use to edit your code. IDEs are typically segmented by programming language and include a series of helpful features to streamline the process of developing an application in that language. If you don’t have an IDE currently set up within your work machine, consider checking out Hacktoberfest’s resources page for advice on how to choose an IDE.

      It’s important to take the time to read and understand how the project is organized and the contribution guidelines, and find parts of the code that you can work on. Read any associated documentation provided before making changes. Next, let’s submit a haiku!

      Browse the Codebase

      Adding Content to the Remote Repository

      Now that we have a change made to the haiku repository, we’ll need to track and save that change. The first step in tracking your change is to add it to the version you’re working on. To do that, we’ll execute the command git add . :

      Writing the command in this way allows you to add all changes made to the repository, across files. If you need to only submit changes to an individual file, use git add filename:

      After running the add command, you’ll get no confirmation. To see if your changes have been included in the list of files that is ready to be committed, you can execute the command git status:

      This allows you to check on the status of your tracked changes — you’ll see that your file has been added, but not committed as a change. Git provides this step in the event that you need to amend a change before officially tracking it as new or edited code.

      Git Add

      Next, let’s commit our change. Execute the command git commit, and add a message so that other developers who are collaborating on this project will know about the changes you’ve made:

      • git commit -m "added sammy haiku"

      Writing your commit with a message allows developers to be informed of changes that are made — this message is tracked along with a commit ID and your username.

      Git Commit

      After committing, we’ll need to push changes from our local machine to the remote repository on Github. To do this, let’s execute the command git push:

      Here, we can designate an origin for the push — in this instance, we want our contributions to go to our forked version of DigitalOcean’s haiku repository.

      Git Push

      To recap, so far we’ve identified a repository that we’d like to edit, and took a copy of the repository into our Github account and local machine using fork and clone. We made a change, and submitted our change with git add. We then solidified our change by running git commit, which committed the change. git push pushed our change from our local machines to the remote repository on Github. If we look on Github, we’ll see that the change we made is reflected in the files in our copy of the haiku repository.

      Creating a Pull Request

      We’re now ready to let the maintainers of the project know that we have a change to the repository that we’re confident about and ready to submit. To do this, we’ll click the pull request button to the right.

      Submit a PR

      After the pull request button is clicked, a new page will open with a form that explains what change we made, and shows if the changes made will in any way conflict with the existing content. We’ll add in an appropriate title that details the change, and in the description add an explanation of what changes were made and why. What you add here can vary depending on the project – take a look at the project’s collaboration guidelines to make sure your pull request is formatted correctly.

      After adding in a title and description of the changes made, we’ll scan the pull request page to make sure that our committed change does not conflict with existing changes made to the code repository. If everything checks out, we’ll get a green submit pull request button at the bottom that escalates our request to make a change to the original haiku poem codebase, a contribution that will be live for anyone viewing that main branch. Be patient — it may take maintainers some time to review your request. Amendments and comments can be added on the pull request page, and new commits made to the same affected files will appear in the request’s history.

      Congratulations- we’ve successfully submitted our first pull request!

      In this tutorial, you learned about Git and Github, and successfully identified and submitted a change to a public repository. For Hacktoberfest, you’ll need to submit 4 meaningful pull requests, so again, find the project that resonates with you and have fun hacking!

      To see this tutorial in action, here’s a helpful video that walks you through the process of submitting your first pull request:

      Video: How to Submit Your First PR

      For more information about Hacktoberfest, visit our main page.
      To learn more about Git, visit How to Use Git: A Reference Guide.
      For additional information about Github, visit Github.



      Source link

      Hacktoberfest Workshop Kit: How to Submit Your First Pull Request on Github


      How To Submit Your First Pull Request on GitHub Workshop Kit Materials

      This workshop kit is designed to help an instructor guide an audience without a background in version control or contributing to open source projects through the steps of submitting a pull request from start to finish in roughly thirty minutes. Attendees will finish the workshop with an understanding of version control, open source, Git, and GitHub.

      No prior coding experience is assumed on the part of the audience. Instructors without experience in open source, Git, or GitHub should be able to teach the course after reviewing the material first.

      The aim of this workshop kit is to provide a complete set of resources for a speaker to host a workshop about version control and contributing to open source projects. It includes:

      • Slides and speaker notes that lead participants through setting up their website project, hands-on exercises, and conceptual explanations.
      • A video with a live coding walkthrough of submitting a pull request, tips, and conceptual information about version control and contributing to open source projects.
      • A demonstration repo to allow participants to contribute to an open source project as they follow along in the workshop.

      This workshop kit page is intended to help instructors prepare for the workshop and provide a starting point for learners. Instructors should point learners to this page so they can have access to the slides (which contain useful links).

      If desired, learners can prepare for the workshop by reading the introduction below and making sure that they have the prerequisites ready before the workshop starts.

      If you are interested in participating in this year’s Hacktoberfest, this workshop is a great place to start! This project-based workshop will introduce you to open source, version control, Git, and GitHub using the Cloud Haiku repository as a model. Once you learn the fundamentals, you will know how to contribute to open source projects and submit a pull request on GitHub. No prior coding experience is necessary to follow along in the workshop.

      When software developers work on a project together, oftentimes they’ll need to work on the same code base. While they’re working, each developer needs to know about what changes the others made to the code, so as not to duplicate work or write code over what has already been done. Git, a version control system used to manage developer projects of all sizes, was created in 2005 by Linus Torvalds, the creator of Linux, to help developers contribute to code and share code revisions in a way that was fast, efficient, and inexpensive. Git creates code repositories to help developers edit, share, and publish code for all. GitHub is a cloud-based Git repository hosting service that allows developers to take code that they’ve written on their local machines and share it with the world.

      With Git and GitHub, developers from all over the world collaborate on all sorts of projects — many of the websites you visit regularly are maintained using GitHub. Knowing how to use Git and GitHub, and learning how to contribute to open source projects will provide new developers with a strong start in gaining the skills they need to join the software engineering community at large.

      In this workshop, we’ll introduce you to Git and GitHub, the version control system that Hacktoberfest uses to track your progress, and the repository hosting service that shares projects to collaborate on. By the end of this tutorial, you’ll be ready to submit your first pull request and will be well on your way to participating in Hacktoberfest!

      To participate as a workshop leader or learner, you will need the following:

      • A code editor. In this workshop, we’ll be using Visual Studio Code, which you can download for free for Mac, Windows, or Linux.
      • A web browser. In this workshop, we’ll be using Google Chrome as our default browser, which you can also download for free for Mac, Windows, or Linux.
      • A GitHub account. In this workshop, we’ll make a contribution to an open source repo on GitHub. You can sign up for a free account using your default browser.

      Once you have your prerequisites ready, you will be ready to begin the workshop. Refer to the speaker slides for helpful links after the workshop or watch the How to Submit Your First Pull Request video on the Hacktoberfest resources page to review.



      Source link