Create, Merge & Manage Pull Requests On GitHub

Version Control Part - II

ยท

4 min read

Create, Merge & Manage Pull Requests On GitHub

Introduction

Creating a pull request (PR) on GitHub involves several steps. This article will take you through the step by step process of creating pull requests on GitHub and getting them merged.

This article is the second part of my 3-article series on Version Control. The first article teaches you about the most common git commands. You can read the Part 1 here.

10 Steps For Creating & Merging Pull Requests On GitHub

Step 1 : Fork the Repository

  • Go to the GitHub repository you want to contribute to.
  • Click the "Fork" button in the upper-right corner. This creates a copy of the repository in your GitHub account. This copy is known as the forked repository.

Step 2 : Clone Your Fork

  • Open the terminal or a Git client on your local machine.
  • Clone your forked repository to your local machine using the following command:
    git clone <fork-url>

Step 3 : Create a New Branch
Create a new branch for your changes. This is a good practice to isolate your work from the main branch. Use the following commands:

git checkout -b <feature-branch-name>

Step 4 : Make Changes
Make the necessary changes to the code in your local branch.

Step 5 : Commit Changes

  • Add your changes to the staging area:
git add .
  • Commit your changes with a meaningful message:
git commit -m "Your commit message here"

Step 6 : Push Your Branch to GitHub
Push your branch to your fork on GitHub:

git push origin <feature-branch-name>

Step 7 : Create the Pull Request

  • Go to your fork on GitHub and select the branch you just pushed.
  • Click the "New Pull Request" button.
  • In the "base" or "target" repository and branch, select the repository and branch you want to merge your changes into. Typically, this will be the original repository's main branch.
  • In the "compare" or "head" repository and branch, select your fork and branch with the changes.
  • Provide a descriptive title and description for your pull request, explaining what it does and why.
  • If your pull request is related to an issue in the repository, you can reference it using the # symbol and the issue number (Ex - "Closes #729").
  • Review your changes and, if everything looks good, click the "Create Pull Request" button.

Step 8 : Discuss and Review

  • Your pull request will now be open for discussion and review by the project maintainers and collaborators.
  • Be prepared to address feedback and make additional changes as needed.

Step 9 : Merge the Pull Request
Once your pull request is approved, a maintainer or collaborator can merge it into the main repository.

Step 10 : Clean Up
After your pull request is merged, you can delete the branch both locally and on your fork on GitHub.

Conclusion

Your pull request is now part of the main project, and your contributions have been successfully integrated. This process can vary slightly depending on the Git platform and the specific repository, but the general steps are consistent.

You can read other articles written by me through these links.

System Design Series
Introduction To Parallel Computing
Deep Dive Into Virtualization
Insights Into Distributed Computing

Cloud Computing Series
1. Cloud Service Models
2. Cloud Deployment Models
3. Cloud Security
4. Cloud Architecture
5. Cloud Storage
6. Networking In The Cloud
7. Cloud Cost Management
8. DevOps In Cloud & CI/CD
9. Serverless Computing
10. Container Orchestration
11. Cloud Migration
12. Cloud Monitoring & Management
13. Edge Computing In Cloud
14. Machine Learning In Cloud

Computer Networking Series
1. Computer Networking Fundamentals
2. OSI Model
3. TCP/IP Model : Application Layer
4. TCP/IP Model : Transport Layer
5. TCP/IP Model : Network Layer
6. TCP/IP Model : Data Link Layer

Version Control Series
1. Complete Guide to Git Commands
2. Create & Merge Pull Requests
3. Making Open Source Contributions

Linux
Complete Guide to Linux Commands

Thanks For Reading! ๐Ÿ’™
Garvit Singh

ย