Content (i.e. feature) Branch

Content (i.e. feature) Branch#

In the previous section we defined the main branch as the deployment branch.

This section is intended for advanced users, who would like to:

  1. deploy their website from a so-called feature branch,

  2. keep the main branch in sync with the original source, i.e. the upstream.

There is a valid reason why one would want the workflow triggering from a non-main branch, i.e. commonly termed a feature branch[1].

The argument for doing so is to keep the main branch of your fork https://github.com/<your-username>/data-science-for-esm synchronized/identical to the main branch of the upstream https://github.com/fneum/data-science-for-esm repository.

In particular, this approach facilitates comparing the fork and the upstream, retrieving updates/patches, and also allows you resetting your fork, in case something has gone completely wrong.

A simple workflow of keeping your fork’s main up-to-date with the upstream main is:

git remote add upstream https://github.com/fneum/data-science-for-esm
git switch main # move to the main branch of your fork
git pull upstream main

To merge the main branch updates, obtained by synchronizing your main with the upstream main, into your Jupyter Book content_branch:

git switch content_branch # alternatively you can also do: git checkout content_branch
git cherry-pick <last main branch commit hash>
  • At this point, if there are conflicts, resolve them manually, while keeping in mind that “incoming” refers to the changes obtained from the upstream using git pull and “HEAD” refers current state of the content_branch:

git cherry-pick --continue

In order to save these changes, follow the instructions in Modify the Content section.