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

adaptations of slides with new practice repo

parent 93addf9a
No related branches found
No related tags found
No related merge requests found
Showing
with 24 additions and 102 deletions
......@@ -4,11 +4,11 @@
* Work on your <font color="red">own</font> branch (in your own fork), and **not** on `master` and **not** on `develop`
* Do **not push** to `master` or `develop`, but **submit a PR/MR**
* Do **not push** to `master`, but **submit a PR**
* Get your code **reviewed** by your peers (submit a PR/MR!)
* Get your code **reviewed** by your peers (submit a PR!)
* Submit a PR/MR **often**!
* Submit a PR **often**!
* `clone` a repository, do not download the `.zip` file.
......@@ -21,7 +21,7 @@
* Stage only 1 file at once using
```bash
$ git add myFile.txt
$ git add myFile.md
```
* Commit **only a few files** at once (after multiple separate `git add` commands)
......
......@@ -78,7 +78,7 @@ Assume that you want to work on a function for adding 2 numbers.
<font color="red">Create a new **branch**!</font>
```bash
$ git checkout -b add-2-numbers
$ git checkout -b myBranch
```
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"/>
......@@ -88,7 +88,7 @@ The `-b` flag creates the branch. Locally, you have your own version now:
Push your version to your fork:
```bash
$ git push origin add-2-numbers
$ git push origin myBranch
```
......
......@@ -9,7 +9,7 @@ or in other words (remember these!):
```bash
$ git pull <remote> <branch>
$ git status
$ git add myFile.txt # example
$ git add myFile.md # example
$ git commit -m "myMessage" # example
$ git push <remote> <branch>
```
......@@ -18,9 +18,9 @@ $ git push <remote> <branch>
## Pull the latest version of an existing branch
Pull the latest revision on branch `add-2-numbers`:
Pull the latest revision on branch `myBranch`:
```bash
$ git pull origin add-2-numbers
$ git pull origin myBranch
# Already up to date
```
......@@ -35,19 +35,14 @@ $ git status
## Modify a file
Modify and rename `addTwoNumbers.m` in the folder `src/firstCommit` as `addTwoNumbers_myName`:
Copy the file `template.md` in the folder `_attendees` and rename it with your firstname:
```bash
$ cd src/firstCommit
$ git mv addTwoNumbers_myName.m addTwoNumbers_laurent.m # replace myName
$ cd _attendees
$ cp template.md myName.md
```
Open the file using the `Visual Studio Code` editor (or any other editor)
and correct the line
```Matlab
c = a - b;
```
Then, make your changes with your favorite editor!
......@@ -71,7 +66,7 @@ exit with `q`
Now, add the file (bring it on stage)
```bash
$ git add addTwoNumbers_laurent.m # replace myName
$ git add myName.md # replace myName
$ git status
# returns the same as before, generally in green (means staged)
```
......@@ -81,7 +76,7 @@ $ git status
## Add a commit message
```bash
$ git commit -m "Correcting formula for adding 2 numbers"
$ git commit -m "Add the profile of <myName>"
$ git status
```
......@@ -90,7 +85,7 @@ $ git status
## Push your file to your fork
```bash
$ git push origin add-2-numbers
$ git push origin myBranch
```
<div class="fragment">
......@@ -99,25 +94,4 @@ $ git push origin add-2-numbers
```bash
$ git log
```
exit by typing `q`
## Do it yourself
**Exercice 1:**
* Edit the test in `test/suite`
<div class="fragment">
<img src="slides/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
exit by typing `q`.
\ No newline at end of file
......@@ -39,20 +39,19 @@ Browse to the original repository and click on the button `Fork`:
## Time to practice!
Fork the practice repository: <br><br>
https://git-r3lab.uni.lu/R3school/git.practice
https://github.com/LCSB-BioCore/basic-git-practice
Then, clone your fork to your home directory!
<img src="slides/img/icon-live-demo.png" height="100px">
```bash
$ git clone ssh://git@git-r3lab-server.uni.lu:8022/yourUserName/
git.practice.git practice
$ git clone git@github.com:<yourName>/basic-git-practice.git
```
Change to the practice directory with:
```bash
$ cd practice
$ cd basic-git-practice
```
......
## Homework
Ideally, do this exercise on a computer on which `Matlab` or `octave` **are** installed.
<div class="fragment">
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">
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.
- Create the new branch `homework_myName`.
- 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/suite` directory to `test_myName.m`.
- Edit the file `test.m` and change the names of the functions accordingly.
- 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.
NOTE: Do not copy the apostrophes, as they just denote the returned string.
Open the Terminal and execute the following command:
```sh
$ matlabroot/bin/matlab -nodesktop -nosplash < test_testAll.m
```
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.
That's it!
2019/2019-06-11_gitTraining/slides/img/branch-create.png

101 KiB | W: | H:

2019/2019-06-11_gitTraining/slides/img/branch-create.png

99.1 KiB | W: | H:

2019/2019-06-11_gitTraining/slides/img/branch-create.png
2019/2019-06-11_gitTraining/slides/img/branch-create.png
2019/2019-06-11_gitTraining/slides/img/branch-create.png
2019/2019-06-11_gitTraining/slides/img/branch-create.png
  • 2-up
  • Swipe
  • Onion skin
2019/2019-06-11_gitTraining/slides/img/branch-merge.png

107 KiB | W: | H:

2019/2019-06-11_gitTraining/slides/img/branch-merge.png

106 KiB | W: | H:

2019/2019-06-11_gitTraining/slides/img/branch-merge.png
2019/2019-06-11_gitTraining/slides/img/branch-merge.png
2019/2019-06-11_gitTraining/slides/img/branch-merge.png
2019/2019-06-11_gitTraining/slides/img/branch-merge.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -44,9 +44,6 @@
{
"filename": "best_practices.md"
},
{
"filename": "homework.md"
},
{
"filename": "thanks.md"
}
......
## Pull and merge requests
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.
**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"/>
......
......@@ -6,7 +6,7 @@
3. Installation of `git`
4. GitHub and GitLab <!--(5min)//-->
5. How do I configure `git`? <!--(5min)//-->
6. Where and how to start <!--(5min)//-->
6. Where and how to start? <!--(5min)//-->
7. What is a fork? <!--(5min)//-->
8. What are branches?
9. The 5 essential commands <!--(10 min)//-->
......
......@@ -5,8 +5,7 @@
Add the `upstream` address (original/protected repository)
```bash
$ git remote add upstream ssh://git@git-r3lab-server.uni.lu:8022/R3school/
git.practice.git
$ git remote add upstream git@github.com:LCSB-BioCore/basic-git-practice.git
```
![bulb](slides/img/bulb.png) Note the change in the URL.
......
......@@ -24,8 +24,7 @@
## References & Cheat sheet
[1]: **Git** Book:
https://git-scm.com/book/en/v2
[1]: Git Book: https://git-scm.com/book/en/v2
[2]: GitHub training services: https://services.github.com/training/
......
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