Following the GitHub Flow - JonasEngstrom/overleaf-article-template GitHub Wiki

After having set up your new article you will probably want to work according to the GitHub Flow (👈 read this page before reading this wiki page, it will make the following easier to understand). This wiki page describes what the GitHub flow would look like using the template.

The following steps make use of Git and the GitHub Command Line Tools and assumes you have installed them and that you have logged in. You will be prompted to log in the first time you run the GitHub Command Line Tools.

The following commands are all run in the terminal prompt, in the local repository directory.

NB! Do not run the sync.sh script while on a branch separate from main. You can still share the PDF files generated in the overleaf directory if you want comments, or ask any coauthors that have access to the GitHub repository to knit the R Markdown file themselves.

Create a Branch

git checkout -b <new-branch-name>

Make Changes and Push New Branch

Staging Files for Commit

git add -A

Commit Changes

git commit -m "Commit message."

Push Changes

git push origin <new-branch-name>

Create a Pull Request

gh pr create

Merge Pull Request

gh pr merge 1

If there are several unmerged pull requests, you can use the following command to find out what number your pull request has:

gh pr list

Delete Branch

The gh pr merge command will ask you whether you want to delete local and remote branches. Choose yes.

Sync with Overleaf

Synd with Overleaf by running the following command, when back om main:

./sync.sh

Using GitHub Command Line Tools to Create Branches

To create a new branch from an issue using GitHub Command Line Tools follow the steps below.

Find Out the Issue’s Number

gh issue list

Create a New Branch and Name it

gh issue develop 43 -cn branch-name

Pull requests are created and merged as described above, under Create a Pull Request and the following sections.