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
## R3.school
<br><br>
#### June 11th, 2019
<div style="top: 6em; left: 0%; position: absolute;">
<img src="theme/img/lcsb_bg.png">
</div>
<div style="top: 5em; left: 60%; position: absolute;">
<img src="slides/img/r3-training-logo.png" height="200px">
</div>
<div style="top: 15em; left: 60%; position: absolute;">
<h3><b>git training for absolute beginners</b></h3>
</div>
<div style="top: 24em; left: 61.5%; position: absolute;">
<b>Laurent Heirendt, Ph.D.</b><br>
laurent.heirendt@uni.lu<br>
<i>Luxembourg Centre for Systems Biomedicine</i>
</div>
## Installation of `git`
<img src="slides/img/github_app.png" class="as-is" height="200" />
**macOS**
Install *Xcode Command Line Tools*
**Windows**
Install Git Bash: <br>`https://git-scm.com/download/win`
**Linux (Ubuntu)**
```bash
$ sudo apt-get install git-all
```
## How to get started?
**macOS**
Start the `Terminal` or `iTerm`.
**Windows**
Start `GUI Bash`.
**Linux (Ubuntu)**
Start the `Terminal` or `Terminator`.
**Is `git` properly installed?**
```bash
$ git --version
# git version 2.10.0
```
\ No newline at end of file
[
{
"filename": "index.md"
},
{
"filename": "overview.md"
},
{
"filename": "wheel.md"
},
{
"filename": "repro_crisis.md"
},
{
"filename": "whatiscode.md"
},
{
"filename": "whyCare.md"
},
{
"filename": "qualityCode.md"
},
{
"filename": "what_is_git.md"
},
{
"filename": "the_terminal.md"
},
{
"filename": "the_editor.md"
},
{
"filename": "installation.md"
},
{
"filename": "github_gitlab.md"
},
{
"filename": "configuration.md"
},
{
"filename": "cloneRepo.md"
},
{
"filename": "forks.md"
},
{
"filename": "branches.md"
},
{
"filename": "essential_commands.md"
},
{
"filename": "merge.md"
},
{
"filename": "syncFork.md"
},
{
"filename": "best_practices.md"
},
{
"filename": "thanks.md"
}
]
## Pull and merge requests
If you want your changes to be reflected on the `develop` or `master` branches,
**submit a PR** via the Github interface.
Use the **interface** to make use of your peers to review your code!
<img src="slides/img/branch-merge.png" class="branch-merge" height="500em"/>
Once merged, you can delete the branch via the interface.
<div class="fragment">
<img src="slides/img/icon-live-demo.png" height="100px" >
\ No newline at end of file
## Overview
1. **PART I**: Quality of computer code.
2. **PART II**: Basic git course
1. The terminal
2. The editor
3. What is `git`? What is the use of `git`? <!--(5 min)//-->
4. Installation of `git`
5. GitHub and GitLab <!--(5min)//-->
6. How do I configure `git`? <!--(5min)//-->
7. Where and how to start? <!--(5min)//-->
8. What is a fork? <!--(5min)//-->
9. What are branches?
10. The 5 essential commands (`pull` / `status` / `add` / `commit` / `push`)
11. What are merge/pull requests? <!--(10 min)//-->
12. How do I synchronize my fork?
13. Best practices
\ No newline at end of file
## Quality of computer code is relevant for everyone.
`This does not concern me – I am only writing documentation or a script for generating a figure that I want to publish!`
[Anonymous researcher]
<div class="fragment">
**Great**, but ...
- Figure may not be reproducible
- Figure looks different when the input data changes
- Documentation will become outdated
… actually, **EVERYONE** writing documentation, a script, or code is concerned!
<div align="center">
<img src="slides/img/snoopy.png">
</div>
## Attributes of high-quality computer code
**Quality** of computer code can be seen as a **group of various attributes**.
High-quality computer code should be:
1. <font color="#A52A2A">**Versioned**</font>: incremental code
2. <font color="#FFA500">**Well-written**</font> (formatted, documented, commented): easy to read by a human
3. <font color="#008931">**Tested**</font>: extensively tested code
<div align="center">
<img src="slides/img/qualitybadge.png">
</div>
\ No newline at end of file
## Reproducibility crisis
<div align="center">
<img src="slides/img/reproCrisis.png">
</div>
*Baker, M., <a href="https://www.nature.com/news/1-500-scientists-lift-the-lid-on-reproducibility-1.19970">1,500 scientists lift the lid on reproducibility</a>, Nature 533, 452–454, 2016. doi:10.1038/533452a*
\ No newline at end of file
## Synchronize your fork
![bulb](slides/img/bulb.png) Remember, we have to regularly update our own copy of the code.
Add the `upstream` address (original/protected repository)
```bash
$ git remote add upstream git@github.com:LCSB-BioCore/basic-git-practice.git
```
![bulb](slides/img/bulb.png) Note the change in the URL.
You can then check whether the remote address is set correctly
```bash
$ git remote -v
```
<div class="fragment">
Fetch the changes from upstream (similar to pull)
```bash
$ git fetch upstream
```
Merge the retrieved changes on the `master` branch:
```bash
$ git checkout master
$ git merge upstream/master
$ git push origin master
```
<div class="fragment">
Do the same for the `develop` branch.
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment