Git Fork

Anonymous contributor's avatar
Anonymous contributor
Published Oct 30, 2023
Contribute to Docs

A fork is a duplicate of an existing repository. This “fork” is an independent entity that allows a contributor to interact with the original repository. Collaboration, experimentation, and contributions to open-source code are made possible by forking. It enables developers worldwide to collaborate, make changes, and contribute to projects while retaining the integrity of the source code. It is a secure approach to modify and test code without making changes directly to the original.

Note: The fork command is provided by a separate command-line tool than Git.

  • Use our beginner friendly Git course to integrate Git and GitHub and manage versions of your projects using Git branches.
    • With Certificate
    • Beginner Friendly.
      4 hours
  • Learn about the command line, starting with navigating and manipulating the file system, and ending with redirection and configuring the environment.
    • With Certificate
    • Beginner Friendly.
      4 hours

Steps to Fork a Repository

  • Step 1

First the user login to his/her GitHub account using the command:

gh auth login
  • Step 2

After successful login, the user can fork the repository using the command:

gh repo fork <repository_url>

This will create a new copy of the original repository.

Note: Users can get repository_url by going to the Github repository that they want to fork and copying the URL.

All contributors

Contribute to Docs

Learn Git on Codecademy

  • Use our beginner friendly Git course to integrate Git and GitHub and manage versions of your projects using Git branches.
    • With Certificate
    • Beginner Friendly.
      4 hours
  • Learn about the command line, starting with navigating and manipulating the file system, and ending with redirection and configuring the environment.
    • With Certificate
    • Beginner Friendly.
      4 hours