How to Fork a Repository on GitHub, Clone It, Make Changes, Create a Branch, and Request a Pull Request


GitHub is a popular platform for hosting and collaborating on software projects. One of the key features of GitHub is the ability to fork repositories, make changes, and contribute back to the original project via pull requests. In this guide, I’ll walk you through the process step by step.

Step 1: Fork the Repository

Forking creates a personal copy of someone else’s repository under your own GitHub account, allowing you to freely experiment and make changes without affecting the original project.

  1. Navigate to the Repository: Go to the GitHub repository you want to contribute to.
  2. Fork the Repository: Click the “Fork” button at the top right corner of the repository page.

Step 2: Clone the Forked Repository

Cloning the repository to your local machine allows you to work on the project offline and use powerful local development tools.

  1. Go to Your Forked Repository: Navigate to the forked repository under your GitHub account.
  2. Clone the Repository: Click the “Code” button and copy the URL. Open your terminal or command prompt and run:

Replace YOUR-USERNAME with your GitHub username and REPOSITORY-NAME with the name of the repository.

Step 3: Create a Branch

Why: Creating a branch allows you to isolate your changes from the main codebase, making it easier to manage and review your work.

  1. Navigate to the Repository Directory: Change into the repository directory using the cd command:
  1. Create a New Branch: Create a new branch for your changes. It’s good practice to give your branch a descriptive name:

Step 4: Make Changes

This step is where you actually implement your contributions or fixes to the project.

  1. Open the Project in Your Editor: Use your favorite code editor to make changes to the project files.
  2. Stage Your Changes: Add the changes to the staging area:
  1. Commit Your Changes: Commit the changes with a descriptive message:

Step 5: Push the Changes to GitHub

Pushing your changes uploads your branch to your forked repository on GitHub, making it accessible for review and integration.

  1. Push the Changes to Your Branch: Push your changes to the branch on your forked repository:

Step 6: Create a Pull Request

A pull request allows you to propose your changes to the original repository’s maintainers, who can then review and merge your contributions.

  1. Navigate to Your Forked Repository: Go to your forked repository on GitHub.
  2. Open a Pull Request: Click the “Compare & pull request” button next to your branch name.
  3. Fill Out the Pull Request Form: Provide a title and description for your pull request, explaining what changes you made and why they should be merged.
  4. Submit the Pull Request: Click the “Create pull request” button.


By following these steps, you can fork a repository, clone it to your computer, make changes, create a branch, and submit a pull request. This process is fundamental to contributing to open-source projects on GitHub. Happy coding!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top