Forking Workflow

Last updated on 2025-11-21 | Edit this page

Estimated time: 0 minutes

Overview

Questions

  • What are the common workflows of the forking branching model?

Objectives

  • First learning objective. (FIXME)

Preparation: Make sure that the main is clean, everything is committed.

The forking workflow is popular among open source software projects and often used in conjunction with a branching model.

FIXME: Why?

The focus of this workflow is to keep the “upstream main” stable while allowing anyone to work on their own contributions independently. Contributions are then suggested and accepted via pull requests. There is not necessarily a develop branch, but you may have release branches.

GitFlow 1
GitFlow 1

In order to understand the forking workflow, let’s first take a look at some special words and roles needed:

upstream - Remote repository containing the “true copy” origin - Remote repository containing the forked copy Pull request(PR) - Merge request from fork to upstream (a request to add your suggestions to the “original copy”) Maintainer - Someone with write access to upstream who vets PRs Contributor - Someone who contributes to upstream via PRs Release manager - A maintainer who also oversees releases

Example release workflow for the astropy Python package Spacetelescope (STScI) style guide for release workflow

GitFlow 1{Alt: A brief refresher from Git Training: The figure shows the local computer (“You”) with branch1 that includes three files of which one is indicated as removed. An arrow from the local computer points to the cloud in which origin and upstream are located, with a picture of GitHubs Octocat. The arrow from local points to origin with you/code(branch1), also with three files of which the same is indicated as removed. Origin has an arrow pointing to upstream with “PR” written on top of it and a screenshot of the “merge pull request” button from the GitHub webinterface. Upstream has spacetelescope/code (main) with the same three files of which the same file is indicated as removed as in local and origin.}

FIXME: Remove text from image and add as caption, source?

GitFlow 1{Alt: …}

FIXME: Alt text. Remove text from image and add as caption, source?

Exercises


FIXME: More description about what is happening at each step in the solution

Challenge

Exercise 1: Create and push a feature branch

You will be assigned a number by the instructor/helper. Create a feature branch based on upstream main. Then create a file in the trainees folder called hello_NNN.txt using the number you just got (replace NNN with your number, e.g. 007). Then push your feature branch out to GitHub.

BASH

git fetch upstream main
git checkout -b myforkfeature upstream/main
touch ./trainees/hello_NNN.txt
git add ./trainees/hello_NNN.txt
git commit -m "adding my textfile"
git push origin myforkfeature
Challenge

Exercise 2: Suggest your changes via pull request

Go to your repository (your fork) on GitHub and find the tab called “Pull requests”. Klick the green “new pull request” button. Then find and click the blue link uder “Compare changes” called “compare across fork”. Select your username and branch name from the right menus. Then click the big green button under the menus called “create pull request”.

GitFlow 1
GitFlow 1
Key Points
  • First key point. Brief Answer to questions. (FIXME)