Setting up version control

What is version control?

What is Git?

NOTE: Git works best with plain-text documents (UTF-8 encoding included), but not binary files like Microsoft Word or Excel documents

What is GitHub?

Basic Git workflow and terminology

Image of a typical, seven-step workflow for open-source software projects, from initial setup to pull requests (Creative Commons license, courtesy of openclipart.org, image `278845`, git-opensource-workflow, by developingo)

(Creative Commons license, courtesy of openclipart.org, image 278845, git-opensource-workflow, by developingo)

Setting up the Git workflow: step by step

Now we’ll go through setting up the Git workflow for PsychoPy®

Step 1: Get Git and GitHub working

Step 1a: Install Git

Step 1b: Sign up for GitHub

Step 2: Fork the psychopy repository

NOTE: Technically and more generally, it’s copying a repository, while also disconnecting it from other previous committers

Step 2a: Find the psychopy/psychopy repository

Step 2b: Fork the psychopy/psychopy repository

Screenshot of where the pull-down menu is to fork a repository

What is a fork?

* though you still need to abide by the the particular license that applies to PsychoPy®

Step 3: download a tool to avoid using the command line (for now)

What if I use Linux?

Step 3a: Download and install GitHub Desktop

Step 4: Cloning

Step 4a: How to start cloning from GitHub Desktop

Step 4b: How to finish cloning

The result of cloning

* It’s updated at the moment you clone it, but as soon as someone else gets their commit(s) pulled in upstream, both your fork and its clone will be out of date. But there’s a way to deal with this (which is really the raison d’être of Git). I will cover this quite soon below.

Nomenclature after forking and cloning

What does all this mean?

* You can’t push to upstream. Origin belongs to you. Upstream does not.

You’re done setting up Git and GitHub

Step 5: Continual Git workflow

* … but can also happen if you change the same line on different branches

5a: Sync (from upstream) to origin

* Note that this can only do something if there is, indeed, something new to synchronize from upstream

5b: Pull from origin

5c: A faster approach (no need to go online)

* Currently, the default is upstream/dev for some reason. We don’t know how to change this in GitHub Desktop for the moment. Choosing that would merge the upstream dev branch into your local release branch, a disastrous merge.

5d: AVOID one method in GitHub Desktop

Branch > Update from upstream/master

Step 6: Continual Git workflow

On to Working on translations