Skip to content
Snippets Groups Projects
Commit c220819c authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

Merge branch 'develop' into 'master'

Regular merge of develop

See merge request R3school/git.slides!37
parents 7b97a94c 43ff6156
No related branches found
No related tags found
No related merge requests found
Showing
with 70 additions and 71 deletions
......@@ -16,7 +16,7 @@ A **version** of the code is referred to as a **branch**.
<div class="fragment">
<br><br>
(Live Demo)
<img src="img/icon-live-demo.png" height="100px">
<br>
......@@ -64,7 +64,9 @@ You can switch to the `develop` branch with
$ git checkout develop
```
(Live Demo)
<div class="fragment">
<br>
<img src="img/icon-live-demo.png" height="100px">
## Create your own version
......@@ -90,5 +92,7 @@ Push your version to your fork:
$ git push origin add-2-numbers
```
<br><br>
(Live Demo)
<br>
<div class="fragment">
<br>
<img src="img/icon-live-demo.png" height="100px">
......@@ -17,17 +17,18 @@ $ 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.
## Why do I need an SSH key?
<div class="fragment">
<br>
**Idea**: <br><br>
communicate **securely** with Github/Gitlab **without** entering the username/password.
**Principle**: <br><br>
Communicate **securely** with Github/Gitlab **without** entering the username/password.
## How do I get and set my SSH key?
......@@ -39,15 +40,17 @@ Check if you already have an SSH key:
$ ls -al ~/.ssh
```
<br>
If there is a file with an extension `.pub`, you already have an SSH key.
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
$ ssh-keygen -t rsa # -b 4096
```
<br>
Then, add the SSH key to Github/Gitlab (see demo).
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
......@@ -17,9 +17,9 @@ $ git push <remote> <branch>
```
## Pull the latest version of an existing repository
## Pull the latest version of an existing branch
Then, pull the latest revision:
Pull the latest revision on branch `add-2-numbers`:
```bash
$ git pull origin add-2-numbers
# Already up to date
......@@ -39,14 +39,14 @@ Modify and rename `addTwoNumbers.m` in the folder `src/firstCommit` as `addTwoNu
```bash
$ cd src/firstCommit
$ mv addTwoNumbers.m addTwoNumbers_myName.m
$ 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
c = a + b;
c = a - b;
```
......@@ -60,39 +60,35 @@ $ git status
<div class="fragment">
<br>
Now, add the file (bring it on stage)
**ADVANCED**: see your changes in the terminal
```bash
$ git add firstCommit/addTwoNumbers_myName.m
# returns the same as before, generally in green (means staged)
$ git diff
```
exit with `q`
<div class="fragment">
<br>
**ADVANCED**: see your changes in the terminal
Now, add the file (bring it on stage)
```bash
$ git diff
$ git add addTwoNumbers_laurent.m # replace myName
$ git status
# returns the same as before, generally in green (means staged)
```
exit with `q`
## Add a commit message
```bash
$ git commit -m "Uncommented line for adding 2 numbers"
$ git commit -m "Correcting formula for adding 2 numbers"
$ git status
```
<br>
You can pull, even at this stage, new possible changes
```bash
$ git pull
```
## Push your file to the repository
## Push your file to your fork
```bash
$ git push
$ git push origin add-2-numbers
```
<div class="fragment">
......@@ -106,19 +102,18 @@ exit by typing `q`
## Do it yourself
* Modify and rename `secondCommit/multiplyTwoNumbers.m`
* Push the file `secondCommit/multiplyTwoNumbers_myName.m`
* Don't forget to add <font color="red">`_myName`</font>
**Exercice 1:**
* Edit the test in `test/suite`
<div class="fragment">
<br>
Commands:
```bash
$ git pull
$ git diff # optional
$ git add secondCommit/multiplyTwoNumbers_myName.m
$ git commit -m "Uncommented line for multiplying 2 numbers"
$ git status
$ git push
$ git log # optional
```
<img src="img/icon-live-demo.png" height="100px">
<div class="fragment">
**Exercice 2:**
* Checkout a new branch named `multiply-2-numbers`
* Rename and modify `src/secondCommit/multiplyTwoNumbers_myName.m`
* Push the file `src/secondCommit/multiplyTwoNumbers_myName.m`
* Don't forget to edit <font color="red">`_myName`</font>
\ No newline at end of file
......@@ -34,13 +34,12 @@ Browse to the original repository and click on the button `Fork`:
![Fork the repo](https://help.github.com/assets/images/help/repository/fork_button.jpg)
(Live Demo)
<div class="fragment">
<img src="img/icon-live-demo.png" height="100px">
## Time to practice!
(Live Demo)
<br>
Fork the practice repository: <br><br>
......@@ -48,6 +47,10 @@ 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">
<div class="fragment">
<br>
```bash
......
......@@ -10,14 +10,19 @@ GitHub is **public**, whereas GitLab is **restricted/private**.
Positive point: GitHub and GitLab are (almost) the same.
## GitHub (Live Demo)
## GitHub
[www.github.com](www.github.com)
[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 (Live Demo)
## 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
## Homework on GitLab
## Homework
This exercise has to be done on your lab computer on which `Matlab` or `octave` **are** installed.
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]) and on [gnu.org/software/octave](gnu.org/software/octave)
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.
## Task
- create a fork of the repository <br>https://git-r3lab.uni.lu/R3/R3.practice
- commit some code
- create a merge request on `GitLab`.
## Detailed instructions
- First, fork the [https://git-r3lab.uni.lu/R3/R3.practice](https://git-r3lab.uni.lu/R3/R3.practice) repository.
- First, fork the [https://git-r3lab.uni.lu/R3school/git.practice](https://git-r3lab.uni.lu/R3school/git.practice) repository.
- Create the new branch `homework_myName`.
- Implement a new function (create a new file `sqrt_myName.m`) called `sqrt_myName(x)` that computes the square root of `x`.
- Implement a new function (create a new file `sqrt_myName.m` in a new folder `src/thirdCommit`) called `sqrt_myName(x)` that computes the square root of `x`.
- Rename the `test.m` file in the `test/` directory to `test_myName.m`.
- Rename the `test.m` file in the `test/suite` directory to `test_myName.m`.
- Edit the file `test.m` and change the names of the functions accordingly.
......
File deleted
slides/img/branch-merge.png

66.8 KiB | W: | H:

slides/img/branch-merge.png

113 KiB | W: | H:

slides/img/branch-merge.png
slides/img/branch-merge.png
slides/img/branch-merge.png
slides/img/branch-merge.png
  • 2-up
  • Swipe
  • Onion skin
File added
slides/img/gray-linen-background-texture_58348.jpg

170 KiB

slides/img/icon-live-demo.png

43.4 KiB

slides/img/r3-training-logo.png

32.4 KiB

slides/img/remote-0-master.png

180 KiB

slides/img/remote-1-remote.png

199 KiB

slides/img/remote-2-push.png

224 KiB

File deleted
Absolute Beginners<br>
<img src="img/Git-Logo-Black.png" class="as-is" height="100px"><br>Workshop
<br>
<img src="img/Git-Logo-Black.png" class="as-is" height="100px"><br>Training for absolute beginners
<img src="img/logoLCSB.png" class="as-is" height="100px">
<img src="img/r3-training-logo.png" class="as-is" height="200px">
<br><br><br><br>
<br><br>
<br>
January 24th, 2019
**Laurent Heirendt, Ph.D.**<br>
laurent.heirendt@uni.lu
<br><br><br><br>
laurent.heirendt@uni.lu
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment