diff --git a/best_practices.md b/best_practices.md index 684c5c0b0a53cad8c7db0434719c874c0cb0885c..91ca870bd5f3e722ad31083ca18c0647ade7272a 100644 --- a/best_practices.md +++ b/best_practices.md @@ -1,14 +1,22 @@ ## Best practices -* `clone` a repository, do not download the `.zip` file. * `pull` before `push` -* Work on your **own** branch (in your own fork) + +* 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** + * Get your code **reviewed** by your peers (submit a PR!) + +* Submit a PR **often**! + +* `clone` a repository, do not download the `.zip` file. + * Do **not** combine `git` commands ```bash $ git commit -am "myMessage" # do not do this ``` + * Stage only 1 file at once using ```bash $ git add myFile.txt @@ -16,13 +24,15 @@ * Commit **only a few files** at once (after multiple separate `git add` commands) -* Always **sync your fork** before starting to work + +* Always **sync your fork** before starting to work on a new branch ```bash $ git remote -v # verify to have the right remote set $ git fetch upstream $ git merge upstream/master $ git push origin master # do not do git push (!) ``` + * `Push` often - avoid conflicts <br><br> diff --git a/essential_commands.md b/essential_commands.md index 81e1af5a39f8ab0058883b6ed2a4090cb8a949f7..96a4ab9ca888c5f70823a1ba7de289fb4d7c38d9 100644 --- a/essential_commands.md +++ b/essential_commands.md @@ -53,7 +53,7 @@ Uncomment the line ``` <br> -Save and rename the file by adding your name +Save and rename the file by <font color="red">adding your name</font> ```bash $ mv firstCommit/addTwoNumbers.m firstCommit/addTwoNumbers_myName.m ``` @@ -110,13 +110,18 @@ $ git push ```bash $ git log ``` -exit with `:q` +exit by typing `q` + +<div class="fragment"> +<br><br> +You just pushed to `master`. This is **not a good** practice (more later!). ## 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> <div class="fragment"> <br> diff --git a/forks.md b/forks.md index cdc7b67b5cc3e7864c71932fc162f228ae39006f..9109050ed31bada378834b3e1fe4028b21234965 100644 --- a/forks.md +++ b/forks.md @@ -9,6 +9,9 @@ Remember: - A **fork** can have multiple **branches**. - A **fork** is not a **branch**, but can have multiple **branches**. +<br><br> +A **fork** is only useful when you want to contribute, e.g., to The COBRAToolbox. + ## Fork via interface diff --git a/homework.md b/homework.md index f09786b9e5e8d21e65935dc27f17c946739fd97a..e812373753aecf1e0a77ac9fdc628873c497504f 100644 --- a/homework.md +++ b/homework.md @@ -1,19 +1,24 @@ -## Homework +## Homework on GitLab *This exercise has to be done on your lab computer on which `Matlab` **is** installed. Don't forget to properly configure `git` with your username and email, as we explained in the training slides.* -During the training, you committed to the `https://git-r3lab.uni.lu/git-training/practice` repository. +<br> +During the training, you committed to the +<br> +[https://git-r3lab.uni.lu/git-training/practice](https://git-r3lab.uni.lu/git-training/practice) +repository. +<br> Your task is to create a fork of this repository, commit some code and create a merge request on `GitLab`. -## Instructions +## Homework: instructions -- First, fork the `https://git-r3lab.uni.lu/git-training/practice` repository. +- First, fork the [https://git-r3lab.uni.lu/git-training/practice](https://git-r3lab.uni.lu/git-training/practice) repository. -- Create the new branch `your_name` +- Create the new branch `homework_myName`. -- Implement a new function called `sqrt_myName` that computes the square root of a number. +- Implement a new function (create a new file `sqrt_myName.m`) called `sqrt_myName(x)` that computes the square root of `x`. - Copy the `test.m` file to `test_myName.m` and change the names of the functions accordingly. @@ -29,4 +34,5 @@ Your task is to create a fork of this repository, commit some code and create a - Assign either Laurent (@laurent.heirendt) or Sylvain (@sylvain.arreckx) depending on your group and your merge-request will be reviewed by one of us. +<br> That's it! diff --git a/installation.md b/installation.md index ba60959775dc78b3e3f65287c9139d414dc1d01f..e614a8a7d2b0e136b9cf116d27603b23e3865380 100644 --- a/installation.md +++ b/installation.md @@ -62,13 +62,23 @@ $ git config --list This should list the configuration with `user.name` and `user.email`. -## I need `The COBRAToolbox`? +## How do I `clone` a repository? -Simply `clone` the repository (i.e., retrieve a copy) +You can clone a repository with ```bash -$ git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox +$ git clone https://github.com/userName/myRepo.git myRepo ``` +<div class="fragment"> +<br> +Clone the training repository with +```bash +$ git clone https://git-r3lab.uni.lu/git-training/practice.git practice +``` +<br> +You may be prompted to enter your credentials. + +<div class="fragment"> <br> Any other rudimentary method such as @@ -77,17 +87,12 @@ Any other rudimentary method such as shall **be avoided**! -## How do I generally `clone` a repository? +## I need `The COBRAToolbox`? -You can clone any other repository with +Simply `clone` the repository (i.e., retrieve a copy) ```bash -$ git clone https://github.com/userName/myRepo.git myRepo +$ git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox ``` -<div class="fragment"> -<br> -Clone the training repository with -```bash -$ git clone https://git-r3lab.uni.lu/git-training/practice.git practice -``` -Note: You may be prompted to enter your credentials. +<br><br> +**Do not** do it right now! Thank you. diff --git a/overview.md b/overview.md index d3553ded005be26313b8f49b2e4a857832c2b7f2..e91ed2f0313c6c7d148f6f67b24c7c92fd81f4b8 100644 --- a/overview.md +++ b/overview.md @@ -5,7 +5,7 @@ 2. GitHub and GitLab <!--(5min)//--> 3. Installation of `git` 4. The 5 essential commands <!--(10 min)//--> - * `clone/pull` / `status` / `add` / `commit` / `push` + * `pull` / `status` / `add` / `commit` / `push` 5. Branches <!--(10 min)//--> 6. Forks <!--(10 min)//--> 7. Best practices diff --git a/the_terminal.md b/the_terminal.md index 833454e72d4ab31854d4b849ec5e87519d243d4e..30844f9443182e47adcbcfa2a5c41a9cd74c9c76 100644 --- a/the_terminal.md +++ b/the_terminal.md @@ -26,12 +26,19 @@ $ ls <div class="fragment"> <br> -Change the directory to a specific folder +Create a directory ```bash -$ cd myDirectory +$ 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 @@ -42,18 +49,11 @@ $ cd ../.. # 2 levels up ``` - -<br> -Create a directory -```bash -$ mkdir myNewDirectory -``` - <div class="fragment"> <br> Move a file or a directory ```bash -$ mv myFile.m myDirectory/. +$ mv myFile.m myNewDirectory/. ``` <div class="fragment"> @@ -61,4 +61,5 @@ $ mv myFile.m myDirectory/. Rename a file or a directory ```bash $ mv myFile.m myNewFile.m +$ mv myNewDirectory myDirectory ```