From 756a3c000a582d0aaa42f665cc550afe50af0c3b Mon Sep 17 00:00:00 2001 From: laurentheirendt <laurent.heirendt@uni.lu> Date: Sat, 8 Jun 2019 12:10:41 +0200 Subject: [PATCH] adding all slides adapted with the lcsb theme in pure markdown --- .../2019-06-11_gitTraining/slides/branches.md | 43 +++++++++---------- .../slides/cloneRepo.md | 4 -- .../slides/configuration.md | 18 ++------ .../slides/essential_commands.md | 24 ++++++----- 2019/2019-06-11_gitTraining/slides/forks.md | 42 ++++++++---------- .../slides/github_gitlab.md | 22 +++------- .../2019-06-11_gitTraining/slides/homework.md | 10 +++-- 2019/2019-06-11_gitTraining/slides/index.md | 6 ++- .../slides/installation.md | 13 +++--- 2019/2019-06-11_gitTraining/slides/merge.md | 10 ++--- .../2019-06-11_gitTraining/slides/syncFork.md | 17 ++++---- 2019/2019-06-11_gitTraining/slides/thanks.md | 39 ++++++++++++++++- .../slides/the_editor.md | 11 ++--- .../slides/the_terminal.md | 26 +++-------- .../slides/what_is_git.md | 20 ++++----- 15 files changed, 149 insertions(+), 156 deletions(-) diff --git a/2019/2019-06-11_gitTraining/slides/branches.md b/2019/2019-06-11_gitTraining/slides/branches.md index c80f1ed3..c71abfe4 100644 --- a/2019/2019-06-11_gitTraining/slides/branches.md +++ b/2019/2019-06-11_gitTraining/slides/branches.md @@ -1,30 +1,29 @@ ## Development scheme -<br> + Generally, in a repository, there are guidelines for contributing. <div class="fragment"> -<br> A common development scheme is dual with a: - **development** version of the code on `develop` - **stable** version of the code on `master` -<br> + A **version** of the code is referred to as a **branch**. <div class="fragment"> -<br><br> -<img src="img/icon-live-demo.png" height="100px"> + +<img src="slides/img/icon-live-demo.png" height="100px"> -<br> <font color="red">In the practice repository, the development branch is called `develop`!</font> <div class="fragment"> -<br> - Use this dual development scheme for your own repositories! + + Use this dual development scheme for your own repositories! + ## Branches @@ -32,13 +31,13 @@ A **version** of the code is referred to as a **branch**. A **version** of the code (i.e., a **branch**) is made up of a sequence of code changes. <div class="fragment"> -<br> + These individual code changes are called **commits**. For instance, the `master` and `develop` branches can be represented as a timeline: +<img src="slides/img/branch-master.png" class="branch-master" height="500em"/> -<img src="img/branch-master.png" class="branch-master" /> ## Switch between branches @@ -48,25 +47,26 @@ List all branches of the repository with $ git branch -a ``` -Exit by typing `q`. The branch with the ***** is the current branch. +Exit by typing `q`. The branch with the * is the current branch. <div class="fragment"> -<br> + Checkout another branch ```bash $ git checkout branchName ``` <div class="fragment"> -<br> + You can switch to the `develop` branch with ```bash $ git checkout develop ``` <div class="fragment"> -<br> -<img src="img/icon-live-demo.png" height="100px"> + +<img src="slides/img/icon-live-demo.png" height="100px"> + ## Create your own version @@ -74,17 +74,16 @@ $ git checkout develop Assume that you want to work on a function for adding 2 numbers. <div class="fragment"> -<br> + <font color="red">Create a new **branch**!</font> ```bash $ git checkout -b add-2-numbers ``` -The `-b` flag creates the branch. +The `-b` flag creates the branch. Locally, you have your own version now: +<img src="slides/img/branch-create.png" class="branch-create" height="500em"/> -Locally, you have your own version now: -<img src="img/branch-create.png" class="branch-create" /> Push your version to your fork: @@ -92,7 +91,7 @@ Push your version to your fork: $ git push origin add-2-numbers ``` -<br> + <div class="fragment"> -<br> -<img src="img/icon-live-demo.png" height="100px"> + +<img src="slides/img/icon-live-demo.png" height="100px"> diff --git a/2019/2019-06-11_gitTraining/slides/cloneRepo.md b/2019/2019-06-11_gitTraining/slides/cloneRepo.md index 99457b56..788536d5 100644 --- a/2019/2019-06-11_gitTraining/slides/cloneRepo.md +++ b/2019/2019-06-11_gitTraining/slides/cloneRepo.md @@ -6,13 +6,9 @@ You have to `clone` it first: $ git clone git@github.com:userName/myRepo.git myRepo ``` -<div class="fragment"> -<br> If you did not configure your SSH key, clone using HTTPS: ```bash $ git clone https://github.com/userName/myRepo.git myRepo ``` -<br> -<div class="fragment"> You will be prompted to enter your credentials. diff --git a/2019/2019-06-11_gitTraining/slides/configuration.md b/2019/2019-06-11_gitTraining/slides/configuration.md index 48f9eea5..b740a6a8 100644 --- a/2019/2019-06-11_gitTraining/slides/configuration.md +++ b/2019/2019-06-11_gitTraining/slides/configuration.md @@ -5,52 +5,42 @@ $ git config --global user.name "Firstname Lastname" $ git config --global user.email "first.last@uni.lu" ``` - -## Test the configuration - Test whether your username and email have been registered ```bash $ git config --list ``` -<br> This should list the configuration with `user.name` and `user.email`. -<br> Exit by typing `q`. + ## What is an SSH key? An SSH key is a secure access credential. -<div class="fragment"> -<br> **Principle**: <br><br> Communicate **securely** with Github/Gitlab **without** entering the username/password. + ## How do I get and set my SSH key? -<br> Check if you already have an SSH key: ```bash $ ls -al ~/.ssh ``` -<br> + If there are 2 files named `id_rsa`, you have an SSH key. -<div class="fragment"> -<br><br> If you don’t have yet an SSH key, you have to generate one: ```bash $ ssh-keygen -t rsa # -b 4096 ``` -<br> Then, add the SSH key to Github/Gitlab. -<div class="fragment"> -<img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file +<img src="slides/img/icon-live-demo.png" height="100px"> \ No newline at end of file diff --git a/2019/2019-06-11_gitTraining/slides/essential_commands.md b/2019/2019-06-11_gitTraining/slides/essential_commands.md index b0a42e16..1d307261 100644 --- a/2019/2019-06-11_gitTraining/slides/essential_commands.md +++ b/2019/2019-06-11_gitTraining/slides/essential_commands.md @@ -1,12 +1,10 @@ ## The 5 essential commands -<br> + **Yes**, you only need 5 commands! -<br> `pull, status, add, commit, push` -<br> or in other words (remember these!): ```bash $ git pull <remote> <branch> @@ -17,6 +15,7 @@ $ git push <remote> <branch> ``` + ## Pull the latest version of an existing branch Pull the latest revision on branch `add-2-numbers`: @@ -26,13 +25,14 @@ $ git pull origin add-2-numbers ``` <div class="fragment"> -<br> + Verify its `status` with: ```bash $ git status ``` + ## Modify a file Modify and rename `addTwoNumbers.m` in the folder `src/firstCommit` as `addTwoNumbers_myName`: @@ -42,7 +42,7 @@ $ cd src/firstCommit $ git mv addTwoNumbers_myName.m addTwoNumbers_laurent.m # replace myName ``` -<br> + Open the file using the `Visual Studio Code` editor (or any other editor) and correct the line ```Matlab @@ -50,6 +50,7 @@ c = a - b; ``` + ## Add your file to the stage First, check the repository status @@ -59,7 +60,7 @@ $ git status ``` <div class="fragment"> -<br> + **ADVANCED**: see your changes in the terminal ```bash $ git diff @@ -67,7 +68,7 @@ $ git diff exit with `q` <div class="fragment"> -<br> + Now, add the file (bring it on stage) ```bash $ git add addTwoNumbers_laurent.m # replace myName @@ -85,6 +86,7 @@ $ git status ``` + ## Push your file to your fork ```bash @@ -92,7 +94,7 @@ $ git push origin add-2-numbers ``` <div class="fragment"> -<br> + **ADVANCED**: see the log of all the commits (and your last one) in the terminal ```bash $ git log @@ -100,6 +102,7 @@ $ git log exit by typing `q` + ## Do it yourself **Exercice 1:** @@ -107,10 +110,11 @@ exit by typing `q` * Edit the test in `test/suite` <div class="fragment"> -<br> -<img src="img/icon-live-demo.png" height="100px"> + +<img src="slides/img/icon-live-demo.png" height="100px"> <div class="fragment"> + **Exercice 2:** * Checkout a new branch named `multiply-2-numbers` diff --git a/2019/2019-06-11_gitTraining/slides/forks.md b/2019/2019-06-11_gitTraining/slides/forks.md index c5aa8bc8..1223e01d 100644 --- a/2019/2019-06-11_gitTraining/slides/forks.md +++ b/2019/2019-06-11_gitTraining/slides/forks.md @@ -1,70 +1,64 @@ ## What is a `fork`? -<div class="fragment"> -<img src="img/fork.jpg" class="as-is" /> -[//]: <> (http://www.cndajin.com/data/wls/246/22302193.jpg) +<img src="slides/img/fork.jpg" class="as-is" height="500em"/> +<!--http://www.cndajin.com/data/wls/246/22302193.jpg--> + ## Not really ... -<img src="img/fork-crossed.png" class="as-is" /> + +<img src="slides/img/fork-crossed.png" class="as-is" height="500em"/> + ## What is a `fork`? + In general, when contributing to a repository, you only have **read** access. -<div class="fragment"> In other words, you can only **pull** (unless it is your own repository or access has been granted). -<div class="fragment"> -<br> In general, you **cannot write** changes. In other words, you do not have **push** access. -<div class="fragment"> You have to work on your **own copy**. -<div class="fragment"> -<br> In other words, you have to work on your own <font color="red">**fork**</font>. + ## How to get a fork? Browse to the original repository and click on the button `Fork`:  -<div class="fragment"> -<img src="img/icon-live-demo.png" height="100px"> +<img src="slides/img/icon-live-demo.png" height="100px"> -## Time to practice! -<br> +## Time to practice! Fork the practice repository: <br><br> https://git-r3lab.uni.lu/R3school/git.practice Then, clone your fork to your home directory! -<div class="fragment"> -<br> -<img src="img/icon-live-demo.png" height="100px"> +<img src="slides/img/icon-live-demo.png" height="100px"> -<div class="fragment"> -<br> ```bash $ git clone ssh://git@git-r3lab-server.uni.lu:8022/yourUserName/ git.practice.git practice ``` -<br> Change to the practice directory with: ```bash $ cd practice ``` + +## A note on shortcuts ... + <font color="red"> Any other rudimentary method such as @@ -73,17 +67,15 @@ Any other rudimentary method such as shall **be avoided**! </font> -<div class="fragment"> -<br>Why? +**Why?** + ## How to update my fork? As you have your own fork, it will not automatically update once the original repository is update. - You have to update it yourself! + You have to update it yourself! -<div class="fragment"> -<br> **More on that later!** diff --git a/2019/2019-06-11_gitTraining/slides/github_gitlab.md b/2019/2019-06-11_gitTraining/slides/github_gitlab.md index a9bc1f27..0b988f0f 100644 --- a/2019/2019-06-11_gitTraining/slides/github_gitlab.md +++ b/2019/2019-06-11_gitTraining/slides/github_gitlab.md @@ -1,28 +1,18 @@ ## GitHub and GitLab -<img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 200px;"/> +<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 200px;"/> <img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 200px;"/> GitHub and GitLab are VCS systems. -GitHub is **public**, whereas GitLab is **restricted/private**. +GitHub/Gitlab are both **publicly available**, but GitLab can be **on-premise**. Positive point: GitHub and GitLab are (almost) the same. -## GitHub +<img src="slides/img/icon-live-demo.png" height="100px"> -[https://github.com](https://github.com) -<br><img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 200px;"/> -<div class="fragment"> -<img src="img/icon-live-demo.png" height="100px"> - - -## GitLab - -[https://git-r3lab.uni.lu](https://git-r3lab.uni.lu) -<br><img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo-extra-whitespace.png" alt="GitLab" style="width: 200px;"/> - -<div class="fragment"> -<img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file +- **GitHub**: [https://github.com](https://github.com) +- Public GitLab: [https://gitlab.com](https://gitlab.com) +- LCSB specific: [https://git-r3lab.uni.lu](https://git-r3lab.uni.lu) \ No newline at end of file diff --git a/2019/2019-06-11_gitTraining/slides/homework.md b/2019/2019-06-11_gitTraining/slides/homework.md index 2e23c513..9d2d5554 100644 --- a/2019/2019-06-11_gitTraining/slides/homework.md +++ b/2019/2019-06-11_gitTraining/slides/homework.md @@ -3,14 +3,15 @@ Ideally, do this exercise on a computer on which `Matlab` or `octave` **are** installed. <div class="fragment"> -<br> + More information on how install these software are on [mathworks.com](www.mathworks.com]) or on [gnu.org/software/octave](gnu.org/software/octave) <div class="fragment"> -<br> + Don't forget to properly configure `git` with your username and email as explained in the training slides. + ## Detailed instructions - First, fork the [https://git-r3lab.uni.lu/R3school/git.practice](https://git-r3lab.uni.lu/R3school/git.practice) repository. @@ -26,7 +27,7 @@ Don't forget to properly configure `git` with your username and email as explain - Before submitting the merge request, verify locally that your code is running properly. - To do so, open the MATLAB application and type `matlabroot`. This will return the path to the MATLAB application. Note or copy this path and exit MATLAB. + To do so, open the MATLAB application and type `matlabroot`. This will return the path to the MATLAB application. Note or copy this path and exit MATLAB. NOTE: Do not copy the apostrophes, as they just denote the returned string. Open the Terminal and execute the following command: @@ -36,9 +37,10 @@ Don't forget to properly configure `git` with your username and email as explain and verify that no error is reported. NOTE: `matlabroot`in the terminal window refers to the copied path from the previous instruction. + + - Create a merge-request. - Assign @laurent.heirendt and your merge-request will be reviewed. -<br> That's it! diff --git a/2019/2019-06-11_gitTraining/slides/index.md b/2019/2019-06-11_gitTraining/slides/index.md index 643822fe..b57fa34a 100644 --- a/2019/2019-06-11_gitTraining/slides/index.md +++ b/2019/2019-06-11_gitTraining/slides/index.md @@ -6,11 +6,15 @@ <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: 60%; position: fixed; width: 50%;"> +<div style="top: 24em; left: 61.5%; position: absolute;"> <b>Laurent Heirendt, Ph.D.</b><br> laurent.heirendt@uni.lu<br> diff --git a/2019/2019-06-11_gitTraining/slides/installation.md b/2019/2019-06-11_gitTraining/slides/installation.md index deec7d09..8d9c0d24 100644 --- a/2019/2019-06-11_gitTraining/slides/installation.md +++ b/2019/2019-06-11_gitTraining/slides/installation.md @@ -1,17 +1,17 @@ ## Installation of `git` -<img src="img/github_app.png" class="as-is" height="200" /> +<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 @@ -19,24 +19,25 @@ $ 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`. -## Is `git` properly installed? +**Is `git` properly installed?** ```bash $ git --version diff --git a/2019/2019-06-11_gitTraining/slides/merge.md b/2019/2019-06-11_gitTraining/slides/merge.md index e7b39dd1..83bc3bd5 100644 --- a/2019/2019-06-11_gitTraining/slides/merge.md +++ b/2019/2019-06-11_gitTraining/slides/merge.md @@ -3,15 +3,11 @@ If you want your changes to be reflected on the `develop` or `master` branches, **submit a MR or a PR** via the Github/Gitlab interface. -<br> 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"/> -<img src="img/branch-merge.png" class="branch-merge" /> - - -<br> Once merged, you can delete the branch via the interface. <div class="fragment"> -<br> -<img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file + +<img src="slides/img/icon-live-demo.png" height="100px" > \ No newline at end of file diff --git a/2019/2019-06-11_gitTraining/slides/syncFork.md b/2019/2019-06-11_gitTraining/slides/syncFork.md index 3cfbd94a..1656902b 100644 --- a/2019/2019-06-11_gitTraining/slides/syncFork.md +++ b/2019/2019-06-11_gitTraining/slides/syncFork.md @@ -1,34 +1,32 @@ ## Synchronize your fork - Remember, we have to regularly update our own copy of the code. + Remember, we have to regularly update our own copy of the code. -## Add the address of the original repository - Add the `upstream` address (original/protected repository) ```bash $ git remote add upstream ssh://git@git-r3lab-server.uni.lu:8022/R3school/ git.practice.git ``` - Note the change in the URL. + Note the change in the URL. -<br> You can then check whether the remote address is set correctly ```bash $ git remote -v ``` <div class="fragment"> -<br> + Fetch the changes from upstream (similar to pull) ```bash $ git fetch upstream ``` -<div class="fragment"> -<br> + + + Merge the retrieved changes on the `master` branch: ```bash $ git checkout master @@ -37,6 +35,7 @@ $ git push origin master ``` <div class="fragment"> + Do the same for the `develop` branch. -<img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file +<img src="slides/img/icon-live-demo.png" height="100px"> \ No newline at end of file diff --git a/2019/2019-06-11_gitTraining/slides/thanks.md b/2019/2019-06-11_gitTraining/slides/thanks.md index 7eb6d2f0..2143dcad 100644 --- a/2019/2019-06-11_gitTraining/slides/thanks.md +++ b/2019/2019-06-11_gitTraining/slides/thanks.md @@ -1,8 +1,43 @@ +## 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. -<center><img src="slides/img/r3-training-logo.png" height="200px"></center> +<img src="slides/img/r3-training-logo.png" height="200px"> Contact us if you need help: -<a href="mailto:r3lab.core@uni.lu">r3lab.core@uni.lu</a> +r3lab.core@uni.lu diff --git a/2019/2019-06-11_gitTraining/slides/the_editor.md b/2019/2019-06-11_gitTraining/slides/the_editor.md index 6a9ad3b5..bec7ea65 100644 --- a/2019/2019-06-11_gitTraining/slides/the_editor.md +++ b/2019/2019-06-11_gitTraining/slides/the_editor.md @@ -1,11 +1,8 @@ -## The editor +## The editor(s) Recommended editors: -- **Visual Studio Code** <br>(https://code.visualstudio.com) -- **Atom** <br>(https://atom.io) +- **Visual Studio Code** (https://code.visualstudio.com) +- **Atom** (https://atom.io) - -## Visual Studio Code - -<br><img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file +<img src="slides/img/icon-live-demo.png" height="100px"> \ No newline at end of file diff --git a/2019/2019-06-11_gitTraining/slides/the_terminal.md b/2019/2019-06-11_gitTraining/slides/the_terminal.md index 61f9a9cc..55821ea3 100644 --- a/2019/2019-06-11_gitTraining/slides/the_terminal.md +++ b/2019/2019-06-11_gitTraining/slides/the_terminal.md @@ -1,22 +1,19 @@ ## The terminal (shell) -<br> **UNIX users (macOS & Linux):** Start the Terminal from your `/Applications` directoy. - Install iTerm2: `https://www.iterm2.com` + Install iTerm2: `https://www.iterm2.com` -<br> **Windows users:** Install Git Bash: <br>`https://git-scm.com/download/win` -<br> **Linux users:** Launch default terminal.<br> - Install Terminator: `https://launchpad.net/terminator` + Install Terminator: `https://launchpad.net/terminator` @@ -27,18 +24,16 @@ Starting the terminal presents itself with a line where you can enter a command cesar@myComputer> ``` -<div class="fragment"> -<br> Often written, for covenience, as ```bash $ ``` -<br> 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 @@ -46,22 +41,16 @@ List the contents of a directory $ ls #-lash ``` -<div class="fragment"> -<br> Create a directory ```bash $ mkdir myNewDirectory ``` -<div class="fragment"> -<br> Change the directory to a specific folder ```bash $ cd myNewDirectory ``` - -<br> Change the directory 1 level and 2 levels up ```bash $ cd .. @@ -71,17 +60,16 @@ $ cd ../.. # 2 levels up ``` -<div class="fragment"> -<br> + + Move a file or a directory ```bash $ mv myFile.m myNewDirectory/. ``` -<div class="fragment"> -<br> + Rename a file or a directory ```bash $ mv myFile.m myNewFile.m $ mv myNewDirectory myDirectory -``` +``` \ No newline at end of file diff --git a/2019/2019-06-11_gitTraining/slides/what_is_git.md b/2019/2019-06-11_gitTraining/slides/what_is_git.md index f33694ff..d3f6de4f 100644 --- a/2019/2019-06-11_gitTraining/slides/what_is_git.md +++ b/2019/2019-06-11_gitTraining/slides/what_is_git.md @@ -1,27 +1,27 @@ ## What is `git`? -<!--  --> +<!--  --> `git` is a **version control system** (VCS) for tracking changes in computer files and coordinating work on those files among multiple people [1]. -<br><br><br>Designed and implemented in 2005 by **Linus Torvalds** +Designed and implemented in 2005 by **Linus Torvalds** - + + +[1] *https://en.wikipedia.org/wiki/Git* -<div align="left"><small>[1] *https://en.wikipedia.org/wiki/Git*</small></div> ## The inventor of `git` - -<br><br> -``` -I'm an egotistical bastard, and I name all my projects after myself. -First Linux, now git. -``` + + +`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** -- GitLab