How to fork a repository in GitHub

GitHub is one of the most commonly used version control and collaboration software in the development community. Developers maintain their projects in the form of repositories.

A fork is a copy of the original repository. Once you fork a repo, a copy is stored on your account and the changes you make to it can be incorporated into your copy of the project instead of the original repo. You then own the copy of the repository.

Later, when you are ready to incorporate the changes into the main project, you can open a pull request and ask the maintainer or the author to add your changes if needed.

Procedure

  • Fork the repo from the original project’s repository. The Fork button is located in the right upper corner.
widget
  • Go to your own account; there will be a copy of the project in your repositories.
  • Next, you can clone the repository locally by using git clone [URL]. In place of [URL], put the forked repository’s URL. Click Code and copy the https URL.
widget
  • Now, make the changes you would like to make to the project locally. Commit and push those changes to your copy of the repository. The git commit and git push commands incorporate changes to your copy by default.
  • To make these changes visible in the original repo as well, click Pull Requests in your copy of the repo and then click on New pull request.
widget
  • Compare the branch you worked on with the one you want to merge it with and open a Pull Request. The maintainers will review your changes and incorporate them into the main project.
widget

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved