Bitzu

GH-900 ยท The GitHub community

Fork, template or clone: what is the difference?

Forking to contribute to a project you cannot push to, forks versus templates versus clones, and topics, READMEs and descriptions that make repositories discoverable.

Key points

  • A fork is your own copy of someone else's repository on GitHub, used to propose changes upstream, and it keeps the full history.
  • A template starts a new project from a repository's files with a single fresh commit.
  • A clone is a copy on your computer.
  • Topics, a clear README and a description help others find a repository.

Source: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template

Practice questions

Single choice

What is a fork?

  1. A copy of a repository on your own computer
  2. A personal copy of another user's repository in your account
  3. A branch protection rule
  4. A release asset
Show answer

Answer: B. A personal copy of another user's repository in your account

A fork lives on GitHub in your account and lets you change code freely and open pull requests upstream. A copy on your computer is a clone.

Select all that apply

Which statements correctly compare forks and template-based repositories?

  1. A fork keeps the parent's full commit history
  2. A repository from a template begins with a single commit
  3. Commits to a fork count toward your contributions graph
  4. Template-based repositories share history with the template so you can merge freely
  5. Forks are meant for starting unrelated new projects
Show answer

Answer: A. A fork keeps the parent's full commit history, B. A repository from a template begins with a single commit

Forks keep full history and are for contributing; templates start fresh with one commit. Fork commits do not count toward the contributions graph, and template branches have unrelated histories.

True or false

Commits you make to a fork count toward your contributions graph.

Show answer

Answer: False

Fork commits do not count toward the graph, while commits in a repository created from a template do.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More GH-900 topics in this module