English
Français

Blog of Denis VOITURON

for a better .NET world

Github Fork - How to contribute to a GitHub project?

Posted on 2025-02-10

Overview

Are you new to community contribution? Have you found a problem in a GitHub repository or would you like to add a new feature and propose it to the repository owners? Then this article is for you.

In just 4 minutes, you’ll learn how to fork a repository, clone it locally and publish your first Pull Request.

Step 1 : Forking a repo

The first step in contributing to a GitHub project is to fork the repository. This creates a copy of the original repository in your own GitHub account. To do this:

  1. Go to the repository page you want to fork.
  2. Click on the “Fork” button at the top right of the page.
  3. Select your GitHub account as the destination for the fork.

If you want to work on a branch other than the default one (main, master, dev), you must uncheck the “Copy the main branch only ’ box at the bottom of the page.

Step 2 : Cloning locally the repo

Once you have forked the repository, you must clone this copy on your local machine so that you can make changes to it. Here’s how to do it:

  1. Go to your repo (fork) page on GitHub.
  2. Click on the “Code” button and copy the URL of the repository.
  3. Open your terminal and run the following command:

    git clone [URL]
    

    Replace the [URL] with the URL you copied.

Step 3 : Creating a new branch

Before making any changes, we recommend that you create a new branch. This keeps your main branch clean and makes it easier to manage changes. To create a new branch, run the following commands in your terminal:

cd [You_Repo]
git checkout [Your_Branch]

Replace [Your_Repo] with the name of your repository and [Your_Branch] with a descriptive name for your branch.

Step 4 : Making and committing changes

Now that you are on a new branch, you can make the necessary changes. Once you’ve made the changes, you need to commit them. Here’s how to do it:

git add .
git commit -m "Description de vos modifications"

Étape 5 : Pushing changes to GitHub

After committing your changes, you need to push them to your fork on GitHub. Use the following command:

git push origin [nom_de_la_branche]

Step 6 : Creating a Pull Request

Finally, to propose your changes to the owners of the original repository, you must create a Pull Request. To do this:

  1. Go to your fork page on GitHub.
  2. Click on the “Compare & pull request” button.
  3. Add a description of your changes and click on “Create pull request”.

Synchronisation

Your fork and the original repository are not automatically updated. To do this, you need to go to your repo (fork) on GitHub and press the Synchronise button.

Languages

EnglishEnglish
FrenchFrançais

Follow me

Recent posts