This lesson is still being designed and assembled (Pre-Alpha version)

Forks

Overview

Teaching: 5 min
Exercises: 5 min
Questions
  • What are forks?

Objectives
  • Understand how forks are created.

A fork of a repository is a new repository which shares code and history with the repository it was forked from - it is a server-side copy (clone) of the original repository. This is particularly useful when you want to work on an open source project where you don’t have write permissions to the repository.

Creating a fork and a local copy of the fork

In order to try out the commands in this lesson we need to set up a repository on GitHub:

Exercise 1: Create a fork

Follow the above instructions to create a fork of the intermediate-git-test-repo and a local copy of it.

Exercise 2: Download data and ensure code runs

To run this code we also need some data files. You can download these from https://noc-oi.github.io/python-intermediate-esces/data/data.zip. Create a sub directory called data in your code repository and extract the zip file into that directory. Ensure the code runs by running it with Python.

Solution

curl -O https://noc-oi.github.io/python-intermediate-esces/data/data.zip
mkdir data
cd data
unzip ../data.zip
cd ..
python plot_buoys.py

We’ll discuss forking further in the Remotes and Branching Models chapters.

Key Points

  • A fork is a server-side copy of a repository

  • A fork can be created on Github through the Fork button in the top right