How to Create a Pull Request on GitHub

How to Create a Pull Request on GitHub


2 min read

Step 1 - Fork the Repository

The first thing you need to do is fork the repository you want to contribute to. This creates a copy of the repository in your own GitHub account. To fork a repo, simply click the "Fork" button in the top right corner of the repository's GitHub page.

Step 2 - Clone Your Fork

Next, you need to clone your forked repository to your local machine. Go to your forked repo on GitHub, click the green "Code" button, and copy the clone URL. Then run the following git command in your terminal to clone your fork:

git clone

Step 3 - Make Your Changes

Create a new branch for your changes:

git checkout -b my-new-feature

Now you can make changes to files in your local clone of the repository. Use your favorite text editor or IDE to make changes.

Step 4 - Commit Your Changes

Once you've made your changes, commit them with descriptive commit messages:

git add .
git commit -m "Add new feature X"

Step 5 - Push to GitHub

Push your changes to your fork on GitHub:

git push origin my-new-feature

Step 6 - Submit a Pull Request

On GitHub, navigate to your fork of the repository. You should see a banner indicating your recently pushed branch with a button to "Compare & pull request". Click that button.

On the next page, give your pull request a title and description explaining your changes. Click "Create pull request".

Step 7 - Discuss and Update

A project maintainer will review your pull request and may request changes. Have a discussion in the comments, and push follow-up commits to your branch to update your pull request.

Step 8 - Merge

Once your pull request has been approved, it will be merged into the original repository! Congratulations on your open-source contribution!

Conclusion: Pull requests are an essential tool for contributing to projects on GitHub. By forking, cloning, making changes, and submitting a PR, you can easily collaborate on open-source software. Make sure your code is well-tested before submitting a PR, and be ready to have a constructive discussion about your changes. Happy coding!

Did you find this article valuable?

Support Edvin Dsouza by becoming a sponsor. Any amount is appreciated!