diff --git a/slides/branches.md b/slides/branches.md index b00b94f266f617208f63b83987ac1ba564f9ae4d..5069da2445231728e472fe53edce9cf58c5d4528 100644 --- a/slides/branches.md +++ b/slides/branches.md @@ -1,3 +1,56 @@ +## 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> +(Live Demo) + + +<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! + + +## Be safe! + +First, browse to the cloned practice directory: +```bash +$ cd practice +``` + +Then, checkout the `develop` version of the code: +```bash +$ git checkout develop +``` + +<div class="fragment"> +<br> +Then, <font color="red">create a new **branch**!</font> + +(more details on **branches** in a few minutes) + +<br> +```bash +$ git checkout -b first-branch +``` + + ## Branches Branch-off within the same repository in order to stay safe! @@ -101,7 +154,7 @@ Detailed information is on [help.github.com/articles/creating-a-pull-request/](h <ol start="3"> <li>Assign your peer <br> - +  </li> </ol> diff --git a/slides/cloneRepo.md b/slides/cloneRepo.md index e4d78710d341605009d8433df5555acf56a1c4cb..99457b5638e09814cd89803782fb32b57e615bdb 100644 --- a/slides/cloneRepo.md +++ b/slides/cloneRepo.md @@ -16,64 +16,3 @@ $ git clone https://github.com/userName/myRepo.git myRepo <br> <div class="fragment"> You will be prompted to enter your credentials. - - -## What is a `fork`? - -<div class="fragment"> -<img src="img/fork.jpg" class="as-is" /> -[//]: <> (http://www.cndajin.com/data/wls/246/22302193.jpg) - - -## Not really ... -<img src="img/fork-crossed.png" class="as-is" /> - - -## 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>. - - -## Time to practice! - -(Live Demo) - -<br> - -Fork the practice repository: <br><br> -https://git-r3lab.uni.lu/R3.training/git.practice - -Then, clone your fork to your home directory! - -<div class="fragment"> -<br> -```bash -$ git clone ssh://git@git-r3lab-server.uni.lu:8022/yourUserName/ - git.practice.git practice -``` - -<div class="fragment"> -<br><br> -<font color="red"> -Any other rudimentary method such as - -*'I simply download the `.zip` and unzip it - works like a charm!'* - -shall **be avoided**! -</font> - -<div class="fragment"> -<br>Why? \ No newline at end of file diff --git a/slides/essential_commands.md b/slides/essential_commands.md index 43bde21dbe1853767cff601bf054f8a2c11dd323..49904675535c255622a38a1abeb3523605af2936 100644 --- a/slides/essential_commands.md +++ b/slides/essential_commands.md @@ -1,3 +1,6 @@ + + + ## The 5 essential commands <br> @@ -19,11 +22,6 @@ $ git push ## Pull the latest version of an existing repository -First, browse to the cloned directory (`git clone [...]`): -```bash -$ cd practice -``` - Then, pull the latest revision: ```bash $ git pull @@ -35,36 +33,19 @@ Verify its `status` with: $ git status ``` +## Modify a file -## Be safe and create a new branch +Modify and rename `addTwoNumbers.m` in the folder `src/firstCommit` as `addTwoNumbers_myName`: -(more on branches in a few minutes) -<br><br><br><br><br> ```bash -$ git checkout -b matrix_vect_mult_myName +$ mv firstCommit/addTwoNumbers.m firstCommit/addTwoNumbers_myName.m ``` - -## Modify a file - -Modify and rename `addTwoNumbers.m` in the folder `firstCommit` - -<br> -Open the file `addTwoNumbers.m` in the folder `firstCommit` using the `Atom` editor (or any other editor). - -<br> -Then, rename the function by adding your name (`addTwoNumbers_myName`) - <br> -Uncomment the line +Open the file using the `Visual Studio Code` editor (or any other editor) +and correct the line ```Matlab -% c = a + b -``` - -<br> -Save and rename the file by <font color="red">adding your name</font> -```bash -$ mv firstCommit/addTwoNumbers.m firstCommit/addTwoNumbers_myName.m +c = a + b; ``` diff --git a/slides/forks.md b/slides/forks.md index 9109050ed31bada378834b3e1fe4028b21234965..1c23e278da38f7e8dddd867d9b82a86f9fcba11f 100644 --- a/slides/forks.md +++ b/slides/forks.md @@ -1,87 +1,81 @@ -## Forks -You **fork** when you want to work on a public repository or a protected repository. +## What is a `fork`? -<br><br> -Remember: - -- A **fork** is your own **copy** of a repository. -- 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. +<div class="fragment"> +<img src="img/fork.jpg" class="as-is" /> +[//]: <> (http://www.cndajin.com/data/wls/246/22302193.jpg) -## Fork via interface +## Not really ... +<img src="img/fork-crossed.png" class="as-is" /> -Browse to the original repository and click on the button `Fork` - +## 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). -## Clone your fork +<div class="fragment"> +<br> +In general, you **cannot write** changes. In other words, you do not have **push** access. -Clone first -```bash -$ git clone https://git-r3lab.uni.lu/myGroup/myRepo.git forkMyRepo -``` +<div class="fragment"> +You have to work on your **own copy**. +<div class="fragment"> <br> -then, you can change to the directory -```bash -$ cd forkMyRepo -``` +In other words, you have to work on your own <font color="red">**fork**</font>. -## Add the address of the original repository +## How to get a fork? -Add the `upstream` address (original/protected repository) -```bash -$ git remote add upstream https://git-r3lab.uni.lu/origGroup/origRepo.git -``` +Browse to the original repository and click on the button `Fork`: -<br> -You can then check whether the remote address is set correctly -```bash -$ git remote -v -``` -<!-- <img src="img/remote-0-master.png" class="as-is" /> //--> -<!-- <img src="img/remote-1-remote.png" class="as-is" /> //--> -<!--- <img src="img/remote-2-push.png" class="as-is" /> //--> + +(Live Demo) -## Synchronize your fork -```bash -$ git checkout master -$ git status -``` +## Time to practice! + +(Live Demo) -<div class="fragment"> <br> -Fetch the changes from upstream (similar to pull) -```bash -$ git fetch upstream -``` + +Fork the practice repository: <br><br> +https://git-r3lab.uni.lu/R3.training/git.practice + +Then, clone your fork to your home directory! <div class="fragment"> <br> -Merge the retrieved changes ```bash -$ git merge upstream/master +$ git clone ssh://git@git-r3lab-server.uni.lu:8022/yourUserName/ + git.practice.git practice ``` <div class="fragment"> -<br> -Push the changes to your own fork -```bash -$ git push origin master -``` +<br><br> +<font color="red"> +Any other rudimentary method such as + +*'I simply download the `.zip` and unzip it - works like a charm!'* + +shall **be avoided**! +</font> + +<div class="fragment"> +<br>Why? + + +## How to update my fork? +As you have your own fork, it will not automatically update once the original repository is update. -## Pull/Merge Requests + You have to update it yourself! -**Good news!** +<div class="fragment"> +<br> +**More on that later!** -Same procedure as with merging a branch... diff --git a/slides/img/bulb.png b/slides/img/bulb.png new file mode 100644 index 0000000000000000000000000000000000000000..590f8d9270fea6be86b5e356cb07cd9232ef7056 Binary files /dev/null and b/slides/img/bulb.png differ diff --git a/slides/list.json b/slides/list.json index cab3401b90d90008aef509b0747a34320869033e..022aba44f06f712c5e492b78689914843d70c96c 100644 --- a/slides/list.json +++ b/slides/list.json @@ -54,7 +54,7 @@ } }, { - "filename": "essential_commands.md", + "filename": "forks.md", "attr": { "data-background": "img/whiteBG.jpg" } @@ -65,6 +65,18 @@ "data-background": "img/whiteBG.jpg" } }, + { + "filename": "essential_commands.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "syncFork.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, { "filename": "best_practices.md", "attr": { diff --git a/slides/ready.md b/slides/ready.md deleted file mode 100644 index 10bdd8c2d6487b004d59155128537a33ad3cf791..0000000000000000000000000000000000000000 --- a/slides/ready.md +++ /dev/null @@ -1,5 +0,0 @@ -## Ready to practice? - -<br>Go to https://git-r3lab.uni.lu/R3.training/git.practice - -<br>And follow the instructions in the `README` file. diff --git a/slides/syncFork.md b/slides/syncFork.md new file mode 100644 index 0000000000000000000000000000000000000000..7d18581db70518db31d7f93dedaa9c229b633f7c --- /dev/null +++ b/slides/syncFork.md @@ -0,0 +1,51 @@ +## Synchronize your fork + + 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/R3.training/ + git.practice.git +``` + + 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 +$ git merge upstream/master +$ git push origin master +``` + +<div class="fragment"> +<br> +Merge the retrieved changes on the `develop` branch: +```bash +$ git checkout develop +$ git merge upstream/develop +$ git push origin develop +``` + + +## Time to practice! + +(Live Demo) \ No newline at end of file diff --git a/slides/the_terminal.md b/slides/the_terminal.md index d63951188fe0e1e98328a138679be04b16b7c3a0..1c6c663fc330437ffaf76a165775a1b6849d7da4 100644 --- a/slides/the_terminal.md +++ b/slides/the_terminal.md @@ -5,7 +5,7 @@ Start the Terminal from your `/Applications` directoy. -*Pro Tip:* Install iTerm2: <br>`https://www.iterm2.com` + Install iTerm2: `https://www.iterm2.com` <br> **Windows users:** @@ -15,8 +15,8 @@ Install Git Bash: <br>`https://git-scm.com/download/win` <br> **Linux users:** -Launch default terminal. -*Pro Tip:* Install Terminator: <br>`https://launchpad.net/terminator` +Launch default terminal.<br> + Install Terminator: `https://launchpad.net/terminator`