Chapter 6

Forking GitHub Repositories

IN THIS CHAPTER

Bullet Understanding forking

Bullet Forking a repository

Bullet Getting unstuck with forking and cloning

Bullet Contributing code via a fork

More than likely, you will want to work on some repositories where you are not the owner or collaborator. In situations where you aren’t the owner or collaborator, you will have to fork the repo if you want to do anything other than browse the files.

In this chapter, I explain what forking is, show you how to fork a repository, and compare forking to cloning and duplicating. I also discuss contributing code via a fork. This chapter also demonstrates how to get the code you want to contribute into a fork if you’ve already made some changes to a clone before forking.

Introducing Forking

A fork of a repository is essentially just a copy of the repository. In the spirit of open source, forking is a way to share with and learn from other developers. Developers can have many motivations for forking a repository, but three of the most common reasons are to

  • Contribute to someone else’s project
  • Use someone else’s project ...

Get GitHub For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.