Commit 39d29c4e authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

Merge branch 'add-git-training-march-21' into 'develop'

add slides for upcoming git training

See merge request R3/school/courses!96
parents a07b8438 640b8b76
Pipeline #38554 passed with stages
in 4 minutes and 23 seconds
# Elixir-LU training (R3.school)
## March 18th, 2021
<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/elixir.png" height="200px">
<img src="slides/img/r3-training-logo.png" height="200px">
<br><br><br><br>
<h1>Basic git training</h1>
<br><br><br><br>
<h4>
Laurent Heirendt, Ph.D.<br>
laurent.heirendt@uni.lu<br>
<i>ELIXIR/LU, Luxembourg Centre for Systems Biomedicine</i>
</h4>
</div>
# The terminal (shell)
**macOS users:**
> Start the Terminal from your `/Applications` directoy.
![bulb](slides/img/bulb.png) Install iTerm2: [https://www.iterm2.com](https://www.iterm2.com)
<br>
**Windows users:**
> Install Git Bash: [https://git-scm.com/download/win](https://git-scm.com/download/win)
<br>
**Linux users:**
> Launch default terminal.<br>
![bulb](slides/img/bulb.png) Install Terminator: [https://launchpad.net/terminator](https://launchpad.net/terminator)
# Installation of `git`
<img src="slides/img/github_app.png" class="as-is" height="200" />
**macOS**
> Install *Xcode Command Line Tools*
<br>
**Windows**
> Install Git Bash: <br>`https://git-scm.com/download/win`
<br>
**Linux (Ubuntu)**
```bash
$ sudo apt-get install git-all
```
# How to get started?
**macOS**
> Start the `Terminal` or `iTerm`.
<br>
**Windows**
> Start `GUI Bash`.
<br>
**Linux (Ubuntu)**
> Start the `Terminal` or `Terminator`.
[
{ "filename": "index.md" },
{ "filename": "overview.md" },
{ "filename": "what_is_git.md" },
{ "filename": "github_gitlab.md" },
{ "filename": "installation.md" },
{ "filename": "the_terminal.md" },
{ "filename": "the_editor.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 (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. What is `git`? What is the use of `git`?
2. GitHub and GitLab
3. The terminal
4. Installation of `git`
5. The editor
6. How do I configure `git`?
7. Where and how to start?
8. What is a fork?
9. What are branches?
10. The 5 essential commands (`pull` / `status` / `add` / `commit` / `push`)
11. What are merge/pull requests?
12. How do I synchronize my fork?
13. Best practices
\ 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:
```bash
$ git checkout develop
$ git merge upstream/develop
$ git push origin develop
```
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
# 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.
<br>
<center>
<img src="slides/img/elixir.png" height="200px">
<img src="slides/img/r3-training-logo.png" height="200px">
<br><br>
Contact us if you need help:
<br><br>
lcsb-r3@uni.lu
</center>
\ No newline at end of file
# The editor(s)
Recommended editors:
- **Visual Studio Code** [https://code.visualstudio.com](https://code.visualstudio.com)
- **Atom** [https://atom.io](https://atom.io)
*Note*: Other editors such as can, of course, also be used. Examples:
- IntelliJ IDEA [https://www.jetbrains.com/idea](https://www.jetbrains.com/idea)
- Sublime Text [https://www.sublimetext.com](https://www.sublimetext.com)
<img src="slides/img/icon-live-demo.png" height="100px">
\ No newline at end of file
# 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 `~/`.
<br>
**Is `git` properly installed?**
```bash
$ git --version
# git version 2.10.0
```
# 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
Markdown is supported
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