DEV Community

Cover image for A Simple Guide to Creating a Pull Request on GitHub

A Simple Guide to Creating a Pull Request on GitHub

GitHub is a platform that helps devs to work with others on coding projects and many other ways. One of its many key features is the pull request system, where allow devs to make and help to make changes to a project and have them reviewed before being added to the main code. And Here's a guide on how to create a pull request on GitHub and start helping others on with their Code đź‘Ť

Step 1: Fork the Repository for your account

  1. Get a GitHub Account if you dont have one: If you don't have one already, sign up for a GitHub account. Here: https://github.com/signup

  2. Fork a Repository on the main link of the open sorce project : Find the project repository that you'd like to contribute to. In the top right corner of the repository page, you will see a fork button. Clicking this creates a copy of the repository under your GitHub account. đź‘Ť

Step 2: Clone the Forked Repository on to Your Git account

  1. Close the Repository on to your account: On your GitHub profile, you will see the forked repository. Click the “Code” button and copy the repository URL. Open your computer's terminal, type git clone, and paste the URL to create a local copy of the repository on your computer, you usually want git installed on your computer for preference. 👍

  2. Navigate to the Directory and look through: Use the cd command to go into the cloned repository folder:

   cd repository-name
Enter fullscreen mode Exit fullscreen mode

Step 3: Create a New Branch on the code

  1. Make a New Branch on the repository: It's a good idea to create a new branch for each change you're making. This keeps things organized and could help them on the review time, so that would help checking it. To make a new branch, type:
   git checkout -b branch-name
Enter fullscreen mode Exit fullscreen mode
  1. Make Your Changes and what you solve the problem you seen: Now you can make changes to the code using your preferred code editor and make the changes you have already seen and that would make their code better and improve it :0

Step 4: Commit and Push Changes on to the repository

  1. Stage Your Changes: Use the git add command to get your changes ready for saving:
   git add .
Enter fullscreen mode Exit fullscreen mode
  1. Commit Your Changes on the main code: Commit your changes along with a brief message explaining what you did, that will make i faster and easier for the dev to find it and know what was changed.:
   git commit -m "Added new feature"
Enter fullscreen mode Exit fullscreen mode
  1. Push Your Changes to GitHub: Push our commit to your GitHub repository:
   git push origin branch-name
Enter fullscreen mode Exit fullscreen mode

Step 5: Create the Pull Request so they can see it

  1. Open a Pull Request on github: Go to your forked repository on GitHub. You'll see a banner suggesting you create a pull request for the branch you just pushed. Click on “Compare & pull request.”

  2. Describe Your Changes and everything you've made: Write a brief description of what you changed and why. Make sure to be clear on the changes so it make it faster.

  3. Submit the Pull Request on GitHub: Click the "Create pull request" button. Your changes will be sent to the original repository's maintainers for review and will be wanting :0

Step 6: Respond to Feedback that the devs gave

  1. Wait for Review: The maintainers or other contributors will review your pull request. They might ask questions or submit changes, after that you just will have to change it or talk to them about the review.

  2. Make changes if needed: If you receive feedback, make the necessary changes in your branch and push them again. The pull request will automatically update and could go inside the main code.

Step 7: Merge Pull Request on to the main code

  1. Get Your Code Merged: Once the people looking out fr the code are satisfied with your changes, they will merge your pull request into the main repository. Sometimes they might ask to make more changes before merging, but at the end the code will be going to the main, and you will be featured on it.

  2. Delete Your Branch: After your pull request is in the code, you can delete the branch you made since its changes are now part of the main repository and will be showed on the code.

Conclusion to how to made a pull request

You've just learned how to create a pull request on GitHub! This process lets you contribute to projects and collaborate with other developers effectively. By following these steps, you can make a positive impact on coding projects and become an active rt of the open-source community and help many others on their project, there’s many open source projects so why not help everyone?. Remember to communicate clearly and be patient during the reviewed process because they can usually take a while, but just be patient, and you will get an answer. :)

Top comments (0)