diff --git a/2019-01-24_gitTraining/best_practices.md b/2019-01-24_gitTraining/best_practices.md new file mode 100644 index 0000000000000000000000000000000000000000..b139f187935c35c0d2890d425a9617e01b79dbb3 --- /dev/null +++ b/2019-01-24_gitTraining/best_practices.md @@ -0,0 +1,32 @@ +## Best practices + +* `pull` before `push` + +* 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** + +* Get your code **reviewed** by your peers (submit a PR/MR!) + +* Submit a PR/MR **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 + ``` + +* Commit **only a few files** at once (after multiple separate `git add` commands) + +* `Push` often - avoid conflicts + +<br><br> +Remember: **A `push` a day keeps conflicts away!** diff --git a/2019-01-24_gitTraining/branches.md b/2019-01-24_gitTraining/branches.md new file mode 100644 index 0000000000000000000000000000000000000000..c80f1ed3258aef12d42147347b251ef2a7b6b1b2 --- /dev/null +++ b/2019-01-24_gitTraining/branches.md @@ -0,0 +1,98 @@ +## 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"> + + +<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! + + +## Branches + +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="img/branch-master.png" class="branch-master" /> + + +## Switch between branches + +List all branches of the repository with +```bash +$ git branch -a +``` + +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"> + + +## Create your own version + +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. + + +Locally, you have your own version now: +<img src="img/branch-create.png" class="branch-create" /> + + +Push your version to your fork: +```bash +$ git push origin add-2-numbers +``` + +<br> +<div class="fragment"> +<br> +<img src="img/icon-live-demo.png" height="100px"> diff --git a/2019-01-24_gitTraining/cloneRepo.md b/2019-01-24_gitTraining/cloneRepo.md new file mode 100644 index 0000000000000000000000000000000000000000..99457b5638e09814cd89803782fb32b57e615bdb --- /dev/null +++ b/2019-01-24_gitTraining/cloneRepo.md @@ -0,0 +1,18 @@ +## How do I start working on a repository? + +You have to `clone` it first: + +```bash +$ 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-01-24_gitTraining/configuration.md b/2019-01-24_gitTraining/configuration.md new file mode 100644 index 0000000000000000000000000000000000000000..48f9eea53d0cd86ab278322061fa5651320a8b7b --- /dev/null +++ b/2019-01-24_gitTraining/configuration.md @@ -0,0 +1,56 @@ +## How to configure `git`? + +```bash +$ 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 diff --git a/2019-01-24_gitTraining/essential_commands.md b/2019-01-24_gitTraining/essential_commands.md new file mode 100644 index 0000000000000000000000000000000000000000..b0a42e1682bb90d641b97bb6f749eb9edd602a1f --- /dev/null +++ b/2019-01-24_gitTraining/essential_commands.md @@ -0,0 +1,119 @@ +## 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> +$ git status +$ git add myFile.txt # example +$ git commit -m "myMessage" # example +$ git push <remote> <branch> +``` + + +## Pull the latest version of an existing branch + +Pull the latest revision on branch `add-2-numbers`: +```bash +$ git pull origin add-2-numbers +# Already up to date +``` + +<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`: + +```bash +$ 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 +c = a - b; +``` + + +## Add your file to the stage + +First, check the repository status +```bash +$ git status +# uncommitted changes (displayed in red) +``` + +<div class="fragment"> +<br> +**ADVANCED**: see your changes in the terminal +```bash +$ 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 +$ git status +# returns the same as before, generally in green (means staged) +``` + + + +## Add a commit message + +```bash +$ git commit -m "Correcting formula for adding 2 numbers" +$ git status +``` + + +## Push your file to your fork + +```bash +$ 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 +``` +exit by typing `q` + + +## Do it yourself + +**Exercice 1:** + +* Edit the test in `test/suite` + +<div class="fragment"> +<br> +<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 diff --git a/2019-01-24_gitTraining/forks.md b/2019-01-24_gitTraining/forks.md new file mode 100644 index 0000000000000000000000000000000000000000..c5aa8bc801f7df0fcfce2c0a7cb5606b70827774 --- /dev/null +++ b/2019-01-24_gitTraining/forks.md @@ -0,0 +1,89 @@ + +## 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>. + + +## 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"> + + +## Time to practice! + +<br> + +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"> + +<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 +``` + + +<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. + + You have to update it yourself! + +<div class="fragment"> +<br> +**More on that later!** + diff --git a/2019-01-24_gitTraining/github_gitlab.md b/2019-01-24_gitTraining/github_gitlab.md new file mode 100644 index 0000000000000000000000000000000000000000..a9bc1f27e5abefac55edc64dbc47ecca606816b4 --- /dev/null +++ b/2019-01-24_gitTraining/github_gitlab.md @@ -0,0 +1,28 @@ +## 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://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**. + +Positive point: GitHub and GitLab are (almost) the same. + + +## GitHub + +[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 diff --git a/2019-01-24_gitTraining/homework.md b/2019-01-24_gitTraining/homework.md new file mode 100644 index 0000000000000000000000000000000000000000..2e23c5139bd95786c6aaa433cd95e6e1e3d25904 --- /dev/null +++ b/2019-01-24_gitTraining/homework.md @@ -0,0 +1,44 @@ +## Homework + +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. + +- 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. + +<br> +That's it! diff --git a/2019-01-24_gitTraining/img/Git-Logo-Black.png b/2019-01-24_gitTraining/img/Git-Logo-Black.png new file mode 100644 index 0000000000000000000000000000000000000000..b7ed63f2d105656638665907bab77c5e4e375b3d Binary files /dev/null and b/2019-01-24_gitTraining/img/Git-Logo-Black.png differ diff --git a/2019-01-24_gitTraining/img/branch-commit.png b/2019-01-24_gitTraining/img/branch-commit.png new file mode 100644 index 0000000000000000000000000000000000000000..4d31b951c7e0c05027f40566650ce1dfab36a6a1 Binary files /dev/null and b/2019-01-24_gitTraining/img/branch-commit.png differ diff --git a/2019-01-24_gitTraining/img/branch-create.png b/2019-01-24_gitTraining/img/branch-create.png new file mode 100644 index 0000000000000000000000000000000000000000..4ae4e4d42e620d49c6b5592037767805bd5b2188 Binary files /dev/null and b/2019-01-24_gitTraining/img/branch-create.png differ diff --git a/2019-01-24_gitTraining/img/branch-master.png b/2019-01-24_gitTraining/img/branch-master.png new file mode 100644 index 0000000000000000000000000000000000000000..37a8d0c3befc269d562a86e9eae23afd9b2ece15 Binary files /dev/null and b/2019-01-24_gitTraining/img/branch-master.png differ diff --git a/2019-01-24_gitTraining/img/branch-merge.png b/2019-01-24_gitTraining/img/branch-merge.png new file mode 100644 index 0000000000000000000000000000000000000000..b3f4687642cdf98cf086e7d03c86eccea212ed65 Binary files /dev/null and b/2019-01-24_gitTraining/img/branch-merge.png differ diff --git a/2019-01-24_gitTraining/img/bulb.png b/2019-01-24_gitTraining/img/bulb.png new file mode 100644 index 0000000000000000000000000000000000000000..590f8d9270fea6be86b5e356cb07cd9232ef7056 Binary files /dev/null and b/2019-01-24_gitTraining/img/bulb.png differ diff --git a/2019-01-24_gitTraining/img/fork-crossed.png b/2019-01-24_gitTraining/img/fork-crossed.png new file mode 100644 index 0000000000000000000000000000000000000000..cd93216af30439024a36d2d6355d0eae28324511 Binary files /dev/null and b/2019-01-24_gitTraining/img/fork-crossed.png differ diff --git a/2019-01-24_gitTraining/img/fork.jpg b/2019-01-24_gitTraining/img/fork.jpg new file mode 100644 index 0000000000000000000000000000000000000000..35ef53f4225b9286280c99d2c23f1594d380d6c5 Binary files /dev/null and b/2019-01-24_gitTraining/img/fork.jpg differ diff --git a/2019-01-24_gitTraining/img/git_definition.png b/2019-01-24_gitTraining/img/git_definition.png new file mode 100644 index 0000000000000000000000000000000000000000..0676fc7a299fae5c7c3389eed91e21fcb050c629 Binary files /dev/null and b/2019-01-24_gitTraining/img/git_definition.png differ diff --git a/2019-01-24_gitTraining/img/github_app.png b/2019-01-24_gitTraining/img/github_app.png new file mode 100644 index 0000000000000000000000000000000000000000..3cc77f55371f4fdd960e778e4dfcfa5eee1adca4 Binary files /dev/null and b/2019-01-24_gitTraining/img/github_app.png differ diff --git a/2019-01-24_gitTraining/img/graffle/branch-i-state.graffle b/2019-01-24_gitTraining/img/graffle/branch-i-state.graffle new file mode 100644 index 0000000000000000000000000000000000000000..7f2e3d401791c62cb2c615fec2dce64c4a6fb787 Binary files /dev/null and b/2019-01-24_gitTraining/img/graffle/branch-i-state.graffle differ diff --git a/2019-01-24_gitTraining/img/graffle/fork.graffle/data.plist b/2019-01-24_gitTraining/img/graffle/fork.graffle/data.plist new file mode 100644 index 0000000000000000000000000000000000000000..b133d0e9ea14871d87e9c81142e1f828e1f0bc35 Binary files /dev/null and b/2019-01-24_gitTraining/img/graffle/fork.graffle/data.plist differ diff --git a/2019-01-24_gitTraining/img/graffle/fork.graffle/image1.tiff b/2019-01-24_gitTraining/img/graffle/fork.graffle/image1.tiff new file mode 100644 index 0000000000000000000000000000000000000000..98af73f494081c2102ae172be5d2df45588ee3ca Binary files /dev/null and b/2019-01-24_gitTraining/img/graffle/fork.graffle/image1.tiff differ diff --git a/2019-01-24_gitTraining/img/graffle/fork.graffle/image2.tiff b/2019-01-24_gitTraining/img/graffle/fork.graffle/image2.tiff new file mode 100644 index 0000000000000000000000000000000000000000..21127c00eebbf4f4bf48a076df8560c44afb57ca Binary files /dev/null and b/2019-01-24_gitTraining/img/graffle/fork.graffle/image2.tiff differ diff --git a/2019-01-24_gitTraining/img/icon-live-demo.png b/2019-01-24_gitTraining/img/icon-live-demo.png new file mode 100644 index 0000000000000000000000000000000000000000..4b9e6f031078329479b4cc8ea875b9657fda224a Binary files /dev/null and b/2019-01-24_gitTraining/img/icon-live-demo.png differ diff --git a/2019-01-24_gitTraining/img/installation.png b/2019-01-24_gitTraining/img/installation.png new file mode 100644 index 0000000000000000000000000000000000000000..dd278a70c5e8237d32c047759e47fb0812db9db0 Binary files /dev/null and b/2019-01-24_gitTraining/img/installation.png differ diff --git a/2019-01-24_gitTraining/img/linus.jpg b/2019-01-24_gitTraining/img/linus.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5b1cb08a41ecbd2962e253e56ee61f336f1a523b Binary files /dev/null and b/2019-01-24_gitTraining/img/linus.jpg differ diff --git a/2019-01-24_gitTraining/img/logoLCSB.png b/2019-01-24_gitTraining/img/logoLCSB.png new file mode 100644 index 0000000000000000000000000000000000000000..9ca3f0adea7781ff00043b3f5465b28a89026287 Binary files /dev/null and b/2019-01-24_gitTraining/img/logoLCSB.png differ diff --git a/2019-01-24_gitTraining/img/r3-training-logo.png b/2019-01-24_gitTraining/img/r3-training-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..48a3aeaa54640a2bde1d4534dd9922d2ea90840c Binary files /dev/null and b/2019-01-24_gitTraining/img/r3-training-logo.png differ diff --git a/2019-01-24_gitTraining/img/sbgBackgroundWhite.jpg b/2019-01-24_gitTraining/img/sbgBackgroundWhite.jpg new file mode 100644 index 0000000000000000000000000000000000000000..957b9cdb55c95d89bb21f67381bdea2855515a2f Binary files /dev/null and b/2019-01-24_gitTraining/img/sbgBackgroundWhite.jpg differ diff --git a/2019-01-24_gitTraining/img/whiteBG.jpg b/2019-01-24_gitTraining/img/whiteBG.jpg new file mode 100644 index 0000000000000000000000000000000000000000..85212b4fa12b9a27711119a2eb984a10dbf8223f Binary files /dev/null and b/2019-01-24_gitTraining/img/whiteBG.jpg differ diff --git a/2019-01-24_gitTraining/index.md b/2019-01-24_gitTraining/index.md new file mode 100644 index 0000000000000000000000000000000000000000..ff85ce364e931d5fb9b6d5312d7c5450e1f8ebdf --- /dev/null +++ b/2019-01-24_gitTraining/index.md @@ -0,0 +1,11 @@ +<img src="img/Git-Logo-Black.png" class="as-is" height="100px"><br>Training for absolute beginners + +<img src="img/r3-training-logo.png" class="as-is" height="200px"> + +<br><br><br><br> +<br> + +January 24th, 2019 + +**Laurent Heirendt, Ph.D.**<br> +laurent.heirendt@uni.lu \ No newline at end of file diff --git a/2019-01-24_gitTraining/installation.md b/2019-01-24_gitTraining/installation.md new file mode 100644 index 0000000000000000000000000000000000000000..deec7d09a434edccdd7916dd65b4cb66daa93c2e --- /dev/null +++ b/2019-01-24_gitTraining/installation.md @@ -0,0 +1,44 @@ +## Installation of `git` + +<img src="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 +$ 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? + +```bash +$ git --version +# git version 2.10.0 +``` \ No newline at end of file diff --git a/2019-01-24_gitTraining/merge.md b/2019-01-24_gitTraining/merge.md new file mode 100644 index 0000000000000000000000000000000000000000..e7b39dd1ec103b520eeecc35f2e853258f29e707 --- /dev/null +++ b/2019-01-24_gitTraining/merge.md @@ -0,0 +1,17 @@ +## 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. + +<br> +Use the **interface** to make use of your peers to review your code! + +<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 diff --git a/2019-01-24_gitTraining/overview.md b/2019-01-24_gitTraining/overview.md new file mode 100644 index 0000000000000000000000000000000000000000..b6fdb1f93f877caa319acb75f2890ed3283c9c39 --- /dev/null +++ b/2019-01-24_gitTraining/overview.md @@ -0,0 +1,16 @@ +## Overview + +0. The terminal +1. The editor +2. What is `git`? What is the use of `git`? <!--(5 min)//--> +3. Installation of `git` +4. GitHub and GitLab <!--(5min)//--> +5. How do I configure `git`? <!--(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)//--> + * `pull` / `status` / `add` / `commit` / `push` +10. What are merge/pull requests? <!--(10 min)//--> +11. How do I synchronize my fork? +12. Best practices \ No newline at end of file diff --git a/2019-01-24_gitTraining/syncFork.md b/2019-01-24_gitTraining/syncFork.md new file mode 100644 index 0000000000000000000000000000000000000000..3cfbd94a8eab8e9e21170e6612210ed80dc22cff --- /dev/null +++ b/2019-01-24_gitTraining/syncFork.md @@ -0,0 +1,42 @@ +## 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/R3school/ + 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"> +Do the same for the `develop` branch. + +<img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file diff --git a/2019-01-24_gitTraining/thanks.md b/2019-01-24_gitTraining/thanks.md new file mode 100644 index 0000000000000000000000000000000000000000..7337d53f0c95ed0f7d3bca99e1b6afa1cb59552b --- /dev/null +++ b/2019-01-24_gitTraining/thanks.md @@ -0,0 +1,41 @@ +### Let's refresh our memories + +<div class="fragment"> +<br> +- What is a **fork**? + +<div class="fragment"> +<br> +- What are **branches**? + +<div class="fragment"> +<br> +- Can I have **multiple branches** in my fork? + +<div class="fragment"> +<br> +- What is a good **development scheme**? + +<div class="fragment"> +<br> +- What are the **5 essential commands**? + + +### References & Cheat sheet + +[1]: **Git** Book: +https://git-scm.com/book/en/v2 + +<br>[2]: GitHub training services: https://services.github.com/training/ + +<br>[3]: Cheat sheet: http://rogerdudler.github.io/git-guide + + +## Thank you. + +<img src="img/r3-training-logo.png" height="200px"> + +Contact us if you need help: + +r3lab.core@uni.lu + diff --git a/2019-01-24_gitTraining/the_editor.md b/2019-01-24_gitTraining/the_editor.md new file mode 100644 index 0000000000000000000000000000000000000000..6a9ad3b5974c7640cbfd252eb1fded5854105f6b --- /dev/null +++ b/2019-01-24_gitTraining/the_editor.md @@ -0,0 +1,11 @@ +## The editor + +Recommended editors: + +- **Visual Studio Code** <br>(https://code.visualstudio.com) +- **Atom** <br>(https://atom.io) + + +## Visual Studio Code + +<br><img src="img/icon-live-demo.png" height="100px"> \ No newline at end of file diff --git a/2019-01-24_gitTraining/the_terminal.md b/2019-01-24_gitTraining/the_terminal.md new file mode 100644 index 0000000000000000000000000000000000000000..61f9a9cc51ecccb12433f73a6de534f21c1d70b7 --- /dev/null +++ b/2019-01-24_gitTraining/the_terminal.md @@ -0,0 +1,87 @@ +## The terminal (shell) + +<br> +**UNIX users (macOS & Linux):** + +Start the Terminal from your `/Applications` directoy. + + 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` + + + +## First steps in the terminal + +Starting the terminal presents itself with a line where you can enter a command +```bash +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 +```bash +$ 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 .. +# 1 level up + +$ 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 +``` diff --git a/2019-01-24_gitTraining/what_is_git.md b/2019-01-24_gitTraining/what_is_git.md new file mode 100644 index 0000000000000000000000000000000000000000..f33694ff2c6f3177273d3f6bb519432cca1ec810 --- /dev/null +++ b/2019-01-24_gitTraining/what_is_git.md @@ -0,0 +1,36 @@ +## 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** + + + +<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. +``` +Linus Torvald (2007-06-14) + + +## What is the use of `git`? + +* No need to fully rewrite code; **reuse code** and **save time** +* Keep the changes you made over time (**history**) +* Allows you to **backtrack** (if necessary) and undo unwanted changes +* Easily **add contributions** of your collaborators to the main code base + +note: + +Other points to mention: +* git shall not be considered as a nuisance, but as a tool that should help to track and trace the code. +* git is not to track performance. Not using it shows exactly the opposite. diff --git a/list.json b/list.json new file mode 100644 index 0000000000000000000000000000000000000000..bcd4a92325c24f102a968ec31b7d46a2148e9daa --- /dev/null +++ b/list.json @@ -0,0 +1,104 @@ +[ + { + "filename": "index.md", + "attr": { + "data-background": "img/sbgBackgroundWhite.jpg" + } + }, + { + "filename": "overview.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "the_terminal.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "the_editor.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "what_is_git.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "installation.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "github_gitlab.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "configuration.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "cloneRepo.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "forks.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "branches.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "essential_commands.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "merge.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "syncFork.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "best_practices.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "homework.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + }, + { + "filename": "thanks.md", + "attr": { + "data-background": "img/whiteBG.jpg" + } + } +]