Commit 148571ce authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

Merge branch 'git-training-june-2019' into 'develop'

Slides for git training

See merge request R3/outreach/presentations!7
parents 036a198d a0da52d1
## Let's refresh our memories
<div class="fragment">
- What is a **fork**?
<div class="fragment">
- What are **branches**?
<div class="fragment">
- Can I have **multiple branches** in my fork?
<div class="fragment">
- What is a good **development scheme**?
<div class="fragment">
- What are the **5 essential commands**?
## References & Cheat sheet
[1]: Git Book: https://git-scm.com/book/en/v2
[2]: GitHub training services: https://services.github.com/training/
[3]: Cheat sheet: http://rogerdudler.github.io/git-guide
## Thank you.
<img src="slides/img/r3-training-logo.png" height="200px">
Contact us if you need help:
r3lab.core@uni.lu
## The editor(s)
Recommended editors:
- **Visual Studio Code** (https://code.visualstudio.com)
- **Atom** (https://atom.io)
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
## PART II
<br><br><h1>Basic git course</h1>
## The terminal (shell)
**UNIX users (macOS & Linux):**
Start the Terminal from your `/Applications` directoy.
![bulb](slides/img/bulb.png) Install iTerm2: `https://www.iterm2.com`
**Windows users:**
Install Git Bash: <br>`https://git-scm.com/download/win`
**Linux users:**
Launch default terminal.<br>
![bulb](slides/img/bulb.png) Install Terminator: `https://launchpad.net/terminator`
## First steps in the terminal
Starting the terminal presents itself with a line where you can enter a command
```bash
cesar@myComputer>
```
Often written, for covenience, as
```bash
$
```
When you open your terminal (shell), you are located
in your home directory (unless otherwise configured), denoted as `~/`.
## Essential Linux commands
List the contents of a directory
```bash
$ ls #-lash
```
Create a directory
```bash
$ mkdir myNewDirectory
```
Change the directory to a specific folder
```bash
$ cd myNewDirectory
```
Change the directory 1 level and 2 levels up
```bash
$ cd ..
# 1 level up
$ cd ../..
# 2 levels up
```
Move a file or a directory
```bash
$ mv myFile.m myNewDirectory/.
```
Rename a file or a directory
```bash
$ mv myFile.m myNewFile.m
$ mv myNewDirectory myDirectory
```
\ No newline at end of file
## What is `git`?
<!-- ![](slides/img/git_definition.png) -->
`git` is a **version control system** (VCS) for tracking changes in computer files and coordinating work on those files among multiple people [1].
Designed and implemented in 2005 by **Linus Torvalds**
<div align="center">
<img src="slides/img/linus.jpg">
</div>
[1] *https://en.wikipedia.org/wiki/Git*
## The inventor of `git`
<div align="center">
<img src="slides/img/git_definition.png">
</div>
`I'm an egotistical bastard, and I name all my projects after myself.
First Linux, now git.`
Linus Torvald (2007-06-14)
## What is the use of `git`?
* No need to fully rewrite code; **reuse code** and **save time**
* Keep the changes you made over time (**history**)
* Allows you to **backtrack** (if necessary) and undo unwanted changes
* Easily **add contributions** of your collaborators to the main code base
note:
Other points to mention:
* git shall not be considered as a nuisance, but as a tool that should help to track and trace the code.
* git is not to track performance. Not using it shows exactly the opposite.
## What is computer code?
**Computer code**: Set of instructions executed by a computer
**Programming language:**: Style of writing the set of instructions (e.g., C, C++, Fortran, Python, R, Matlab, Julia, …)
**Example:**
<div align="center">
<img src="slides/img/computerCode.png">
</div>
<div class="fragment">
<div align="center"><font color="#A52A2A"><span class="fas fa-arrow-right"></span> Maybe this is not so relevant … or even, why should I care?</font></div>
## PART I
<br><br><h1>Quality of computer code.</h1><br>
<h1>Should you care? What if you didn't?</h1>
## A true story ...
<div align="center">
<img src="slides/img/wheel.png">
</div>
<table style="width:100%">
<tr>
<th width="33%" align="center">Researcher who cares about<br>quality of his code</th>
<th width="33%" align="center">Fellow researcher</th>
<th width="33%" align="center">Pi or Manager</th>
</tr>
</table>
\ No newline at end of file
## Why you should care (1)
<div align="center">
<video width="40%" controls>
<source src="slides/img/arianeLaunch.mov" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
**Aerospace Application**: First launch of Ariane 5, 1996
<font color="#A52A2A"><span class="fas fa-times-circle"></span></font> **Problem**: Rocket exploded shortly after liftoff.
<font color="#FFA500"><span class="fas fa-exclamation-triangle"></span></font> **Root cause of disaster - Software error:**
Horizontal velocity of the rocket exceeded the limits of the 16-bit signed integer value and led to overflow
Ariane 5 launched with the same software as Ariane 4 - **the code had not been tested**
## Why you should care (2)
<div align="center">
<img src="slides/img/therac.png">
</div>
**Biotechnology Application**: Therac-25 – computer controlled radiation therapy machine
<font color="#A52A2A"><span class="fas fa-times-circle"></span></font> **Problem**: Device malfunctions and delivers a lethal dose of radiation - several patients died.
<font color="#FFA500"><span class="fas fa-exclamation-triangle"></span></font> **Root cause of disaster - Software error:**
**No testing** of software before release, **lack of documentation**
.reveal a:not(.image) {
line-height: 1.3em; }
.reveal {
color: #1e497d;
font-family: Lato;
font-weight: normal;
}
/*********************************************
* GLOBAL STYLES
*********************************************/
body {
background: #fff;
background-color: #fff; }
.reveal .slides>section,
.reveal .slides>section>section {
font-size: 32px;
vertical-align: top;
position: absolute;
top: 10%!important;
font-family: Lato;
position: absolute;
top: 0;
left: 0;
vertical-align: top;
line-height: 1.5em;
}
::selection {
color: #fff;
background: rgba(0, 0, 0, 0.99);
text-shadow: none; }
/*********************************************
* HEADERS
*********************************************/
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
margin: -80px 0 20px 20px;
color: #1e497d;
font-family: Lato;
line-height: 1.3em;
letter-spacing: 0em;
text-transform: none;
text-shadow: none; }
.reveal h2 {
color: #1e497d;
font-family: Lato;
font-size: 2em;
}
.reveal h3 {
color: #000000;
font-family: Lato;
font-size: 2em;
}
.reveal h4 {
color: #1e497d;
font-family: Lato;
font-size: 1em;
}
/*********************************************
* LINKS
*********************************************/
.reveal a:not(.image) {
color: #000000;
text-decoration: none;
-webkit-transition: color .15s ease;
-moz-transition: color .15s ease;
-ms-transition: color .15s ease;
-o-transition: color .15s ease;
transition: color .15s ease; }
.reveal a:not(.image):hover {
color: #333333;
text-shadow: none;
border: none; }
.reveal .roll span:after {
color: #fff;
background: black; }
/*********************************************
* IMAGES
*********************************************/
.reveal section img {
margin: 10px 0px;
background: rgba(255, 255, 255, 0.12);
border: 0px solid #000;
box-shadow: 0 0 0px rgba(0, 0, 0, 0.15);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear; }
/*********************************************
* CUSTOMIZATIONS
*********************************************/
.reveal pre {
font-size: 0.8em; /* Make the commands bigger */
box-shadow: 3px 4px 10px rgba(0,0,0,0.8);
width: 120%;
position: relative;
left: -10%;
}
.reveal pre code {
background-color: #333333;
padding: 0.5em;
}
.reveal section img.as-is {
background: none;
border: none;
box-shadow: none
}
.present {
color: #1e497d;
text-align: left;
position: absolute;
top: 0;
left: 0;
}
/*********************************************
* CONTROLS
*********************************************/
.reveal .controls{
display: none;
position: fixed;
width: 110px;
height: 110px;
z-index: 30;
right: 20px;
bottom: 120px;
}
.bottomLogoRight{
position: fixed;
width: 110px;
height: 110px;
z-index: 30;
right: 10px;
bottom: 8px;
}
.bottomLogoLeft{
position: fixed;
width: 110px;
height: 110px;
z-index: 9999;
left: 10px;
bottom: 8px;
}
/*********************************************
* PAGE NUMBERS
*********************************************/
.reveal .slide-number {
position: absolute;
display: block;
right: 120px;
bottom: 60px;
z-index: 31;
font-family: Helvetica, sans-serif;
font-size: 12px;
line-height: 1;
color: #fff;
background-color:#fff;
padding: 5px;
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="32.875px" height="31px" viewBox="0 0 32.875 31" enable-background="new 0 0 32.875 31" xml:space="preserve">
<rect fill="#FFFFFF" width="32.875" height="31"/>
<g>
<g>
<path fill="#00AAE5" d="M9.162,16.84c0.764,0,1.383,0.619,1.383,1.383s-0.619,1.382-1.383,1.383c-0.764,0-1.382-0.619-1.382-1.383
S8.398,16.84,9.162,16.84L9.162,16.84z"/>
</g>
<g>
<path fill="#00AAE5" d="M9.19,21.951c0.63,0,1.141,0.511,1.141,1.141c0.001,0.631-0.511,1.142-1.141,1.142
S8.05,23.723,8.05,23.092C8.049,22.462,8.561,21.951,9.19,21.951L9.19,21.951z"/>
</g>
<g>
<path fill="#00AAE5" d="M9.173,26.648c0.517,0,0.936,0.419,0.936,0.936c0,0.518-0.419,0.936-0.935,0.936
c-0.518,0.001-0.937-0.418-0.937-0.935C8.237,27.067,8.656,26.648,9.173,26.648L9.173,26.648z"/>
</g>
<g>
<path fill="#00AAE5" d="M4.383,16.84c0.764,0,1.383,0.619,1.383,1.383s-0.619,1.382-1.383,1.383C3.619,19.605,3,18.986,3,18.223
S3.619,16.84,4.383,16.84L4.383,16.84z"/>
</g>
<g>
<path fill="#00AAE5" d="M4.393,21.951c0.631,0,1.141,0.511,1.141,1.141c0,0.631-0.51,1.142-1.141,1.142
c-0.63,0-1.141-0.511-1.141-1.142C3.252,22.462,3.763,21.951,4.393,21.951L4.393,21.951z"/>
</g>
<g>
<path fill="#00AAE5" d="M4.393,26.648c0.518,0,0.936,0.419,0.936,0.936c0,0.518-0.418,0.936-0.936,0.936
c-0.516,0.001-0.936-0.418-0.936-0.935C3.457,27.067,3.877,26.648,4.393,26.648L4.393,26.648z"/>
</g>
<g>
<path fill="#00AAE5" d="M13.971,21.951c0.63,0,1.141,0.511,1.141,1.141c0,0.631-0.511,1.142-1.141,1.142
c-0.631,0-1.141-0.511-1.141-1.142C12.829,22.462,13.34,21.951,13.971,21.951L13.971,21.951z"/>
</g>
<g>
<path fill="#00AAE5" d="M13.992,26.648c0.516,0,0.936,0.419,0.936,0.936c0,0.518-0.419,0.936-0.936,0.936
c-0.518,0.001-0.936-0.418-0.936-0.935C13.057,27.067,13.475,26.648,13.992,26.648L13.992,26.648z"/>
</g>
<g>
<path fill="#00AAE5" d="M18.771,21.951c0.63,0,1.141,0.511,1.141,1.141c0,0.631-0.511,1.142-1.141,1.142s-1.141-0.511-1.141-1.142
C17.631,22.462,18.142,21.951,18.771,21.951L18.771,21.951z"/>
</g>
<g>
<path fill="#00AAE5" d="M18.765,26.648c0.517,0,0.936,0.419,0.936,0.936c0,0.518-0.419,0.936-0.936,0.936
c-0.517,0.001-0.936-0.418-0.936-0.935C17.829,27.067,18.248,26.648,18.765,26.648L18.765,26.648z"/>
</g>
<g>
<path fill="#00AAE5" d="M23.559,21.951c0.63,0,1.141,0.511,1.141,1.141c0,0.631-0.511,1.142-1.141,1.142s-1.141-0.511-1.141-1.142
C22.418,22.462,22.929,21.951,23.559,21.951L23.559,21.951z"/>
</g>
<g>
<path fill="#00AAE5" d="M23.544,26.648c0.518,0,0.937,0.419,0.937,0.936c0,0.518-0.419,0.936-0.936,0.936
c-0.517,0.001-0.936-0.418-0.936-0.935C22.609,27.067,23.027,26.648,23.544,26.648L23.544,26.648z"/>
</g>
<g>
<path fill="#00AAE5" d="M28.349,21.951c0.631,0,1.142,0.511,1.142,1.141c0,0.631-0.511,1.142-1.142,1.142
c-0.63,0-1.141-0.511-1.141-1.142C27.208,22.462,27.719,21.951,28.349,21.951L28.349,21.951z"/>
</g>
<g>
<path fill="#00AAE5" d="M28.356,26.664c0.517,0,0.936,0.419,0.936,0.936s-0.419,0.936-0.936,0.936s-0.936-0.419-0.936-0.936
S27.84,26.664,28.356,26.664L28.356,26.664z"/>
</g>
<g>
<path fill="#EE2E27" d="M23.549,14.193c-0.764,0-1.382-0.619-1.382-1.383c-0.001-0.764,0.618-1.382,1.382-1.383
c0.764,0,1.383,0.619,1.383,1.383S24.312,14.193,23.549,14.193L23.549,14.193z"/>
</g>
<g>
<path fill="#EE2E27" d="M23.521,9.083c-0.63,0-1.141-0.511-1.142-1.141c0-0.63,0.511-1.142,1.142-1.142
c0.63,0,1.141,0.512,1.141,1.141C24.662,8.572,24.151,9.083,23.521,9.083L23.521,9.083z"/>
</g>
<g>
<path fill="#EE2E27" d="M23.537,4.385c-0.517,0-0.936-0.418-0.936-0.936c0-0.516,0.419-0.936,0.936-0.936s0.936,0.419,0.936,0.936
C24.473,3.967,24.055,4.385,23.537,4.385L23.537,4.385z"/>
</g>
<g>
<path fill="#EE2E27" d="M28.326,14.193c-0.764,0-1.383-0.619-1.383-1.383s0.619-1.382,1.382-1.383
c0.764,0,1.383,0.619,1.383,1.383S29.089,14.193,28.326,14.193L28.326,14.193z"/>
</g>
<g>
<path fill="#EE2E27" d="M28.315,9.083c-0.63,0-1.141-0.511-1.141-1.141s0.511-1.142,1.141-1.142s1.141,0.512,1.141,1.141
C29.456,8.572,28.945,9.083,28.315,9.083L28.315,9.083z"/>
</g>
<g>
<path fill="#EE2E27" d="M28.317,4.385c-0.517,0-0.936-0.418-0.936-0.936c0-0.516,0.419-0.936,0.936-0.936s0.936,0.419,0.936,0.936
C29.253,3.967,28.834,4.385,28.317,4.385L28.317,4.385z"/>
</g>
<g>
<path fill="#EE2E27" d="M18.725,14.193c-0.763,0-1.382-0.619-1.382-1.383s0.618-1.382,1.382-1.383
c0.764,0,1.383,0.619,1.383,1.383S19.488,14.193,18.725,14.193L18.725,14.193z"/>
</g>
<g>
<path fill="#EE2E27" d="M18.741,9.083c-0.63,0-1.141-0.511-1.141-1.141s0.511-1.142,1.141-1.142s1.141,0.512,1.142,1.141
C19.883,8.572,19.372,9.083,18.741,9.083L18.741,9.083z"/>
</g>
<g>
<path fill="#EE2E27" d="M18.719,4.385c-0.517,0-0.936-0.418-0.936-0.936c0-0.516,0.418-0.936,0.936-0.936
c0.517,0,0.936,0.419,0.936,0.936C19.654,3.967,19.235,4.385,18.719,4.385L18.719,4.385z"/>
</g>
<g>
<path fill="#EE2E27" d="M13.965,14.193c-0.764,0-1.383-0.619-1.383-1.383s0.619-1.382,1.383-1.383
c0.764,0,1.383,0.619,1.383,1.383S14.729,14.193,13.965,14.193L13.965,14.193z"/>
</g>
<g>
<path fill="#EE2E27" d="M13.94,9.083c-0.63,0-1.141-0.511-1.141-1.141s0.511-1.142,1.141-1.142s1.142,0.512,1.142,1.141
C15.082,8.572,14.57,9.083,13.94,9.083L13.94,9.083z"/>
</g>
<g>
<path fill="#EE2E27" d="M13.945,4.385c-0.517,0-0.936-0.418-0.936-0.936c0-0.516,0.419-0.936,0.936-0.936
c0.518,0,0.936,0.419,0.936,0.936C14.881,3.967,14.463,4.385,13.945,4.385L13.945,4.385z"/>
</g>
<g>
<path fill="#EE2E27" d="M9.186,14.193c-0.764,0-1.383-0.618-1.383-1.382c0-0.763,0.619-1.382,1.383-1.382s1.383,0.618,1.383,1.382
C10.568,13.574,9.949,14.193,9.186,14.193L9.186,14.193z"/>
</g>
<g>
<path fill="#EE2E27" d="M9.15,9.083c-0.631,0-1.142-0.511-1.142-1.141S8.52,6.801,9.15,6.801c0.629,0,1.141,0.512,1.141,1.141
C10.291,8.572,9.78,9.083,9.15,9.083L9.15,9.083z"/>
</g>
<g>
<path fill="#EE2E27" d="M9.166,4.385c-0.518,0-0.936-0.418-0.936-0.936c0-0.516,0.418-0.936,0.936-0.936
c0.517,0,0.936,0.419,0.936,0.936C10.102,3.967,9.683,4.385,9.166,4.385L9.166,4.385z"/>
</g>
<g>
<path fill="#EE2E27" d="M4.387,11.398c0.764,0,1.383,0.619,1.383,1.383s-0.619,1.382-1.383,1.382
c-0.764,0.001-1.383-0.618-1.383-1.382S3.623,11.398,4.387,11.398L4.387,11.398z"/>
</g>
<g>
<path fill="#EE2E27" d="M4.363,9.083c-0.631,0-1.142-0.511-1.142-1.141s0.511-1.142,1.142-1.142c0.629,0,1.141,0.512,1.141,1.141
C5.504,8.572,4.993,9.083,4.363,9.083L4.363,9.083z"/>
</g>
<g>
<path fill="#EE2E27" d="M4.354,4.371c-0.516,0-0.936-0.419-0.936-0.936S3.838,2.5,4.354,2.5c0.518,0,0.936,0.418,0.936,0.936
C5.289,3.952,4.871,4.371,4.354,4.371L4.354,4.371z"/>
</g>
<g>
<polygon fill="#5F6062" points="13.275,19.778 15.215,19.778 15.215,19.342 13.77,19.342 13.77,16.323 13.275,16.323
13.275,19.778 "/>
</g>
<g>
<path fill="#5F6062" d="M15.339,19.902h-2.188v-3.703h0.742v3.019h1.445V19.902z M13.399,19.654h1.691v-0.188h-1.445v-3.019
h-0.246V19.654z"/>
</g>
<g>
<path fill="#5F6062" d="M20.233,16.412c-0.248-0.109-0.51-0.148-0.777-0.148c-1.055,0-1.827,0.707-1.827,1.771
c0,1.1,0.728,1.802,1.822,1.802c0.203,0,0.524-0.015,0.787-0.123l-0.03-0.48c-0.173,0.104-0.505,0.168-0.752,0.168
c-0.718,0-1.302-0.539-1.302-1.351c0-0.777,0.529-1.352,1.326-1.352c0.253,0,0.495,0.064,0.713,0.193L20.233,16.412L20.233,16.412
z"/>
</g>
<g>
<path fill="#5F6062" d="M19.451,19.961c-1.164,0-1.946-0.774-1.946-1.926c0-1.116,0.802-1.896,1.951-1.896
c0.314,0,0.585,0.052,0.827,0.159l0.081,0.036L20.3,17.1L20.13,17c-0.198-0.117-0.416-0.176-0.65-0.176
c-0.708,0-1.202,0.505-1.202,1.228c0,0.711,0.495,1.227,1.178,1.227c0.245,0,0.547-0.066,0.688-0.15l0.174-0.104l0.049,0.772
l-0.082,0.034C20.07,19.917,19.797,19.961,19.451,19.961z M19.456,16.388c-1.003,0-1.703,0.677-1.703,1.647
c0,1.019,0.667,1.678,1.698,1.678c0.264,0,0.485-0.028,0.658-0.083l-0.013-0.21c-0.2,0.07-0.451,0.106-0.64,0.106
c-0.813,0-1.426-0.634-1.426-1.475c0-0.869,0.596-1.476,1.45-1.476c0.213,0,0.416,0.042,0.604,0.123l0.017-0.206
C19.912,16.422,19.7,16.388,19.456,16.388z"/>
</g>
<g>
<path fill="#5F6062" d="M24.527,16.387c-0.237-0.084-0.51-0.123-0.737-0.123c-0.624,0-1.108,0.326-1.108,0.94
c0,1.074,1.484,0.861,1.484,1.633c0,0.406-0.396,0.564-0.678,0.564c-0.253,0-0.55-0.099-0.718-0.168l-0.05,0.46
c0.228,0.074,0.466,0.144,0.708,0.144c0.693,0,1.263-0.292,1.263-1.029c0-1.139-1.485-0.985-1.485-1.648
c0-0.361,0.326-0.46,0.604-0.46c0.258,0,0.396,0.044,0.648,0.144L24.527,16.387L24.527,16.387z"/>
</g>
<g>
<path fill="#5F6062" d="M23.429,19.961c-0.266,0-0.524-0.077-0.747-0.15l-0.096-0.031l0.079-0.725l0.153,0.063
c0.09,0.037,0.405,0.159,0.67,0.159c0.154,0,0.554-0.079,0.554-0.44c0-0.262-0.22-0.378-0.579-0.547
c-0.403-0.189-0.905-0.425-0.905-1.085c0-0.646,0.484-1.064,1.232-1.064c0.261,0,0.545,0.047,0.779,0.13l0.097,0.034l-0.108,0.711
l-0.145-0.057c-0.243-0.096-0.365-0.135-0.603-0.135c-0.219,0-0.479,0.058-0.479,0.336c0,0.199,0.199,0.305,0.524,0.461