Lesson 37 +15 XP

GitHub Fork

GitHub Fork

A fork is your own personal copy of someone else's repository, made on GitHub.

The fork button

On any public repository, click the Fork button at the top right. GitHub creates a copy under your own account. The fork button is on GitHub's website, not a Git command.

Why fork?

  • Make your own copy of a project to experiment with.
  • Contribute to a project you do not have write access to.
  • Use a project as a starting point for your own idea.

Your fork is separate

A fork is a whole new repository owned by you. You can change it freely without affecting the original project.

Keep your fork updated

The original project keeps moving. To bring those changes into your fork:

git remote add upstream https://github.com/original/owner/repo.git
git pull upstream main

You add the original repository as a remote named upstream, then pull from it.

TL;DR

  • A fork is a copy of a repository under your GitHub account.
  • Click the Fork button on GitHub to create one.
  • You own your fork and can edit it freely.
  • Add the original as a remote named upstream to stay updated.