diff --git a/img/branch-commit.png b/img/branch-commit.png index 76ddf1b058601775005bc041b08de7e348b2dba5..4d31b951c7e0c05027f40566650ce1dfab36a6a1 100644 Binary files a/img/branch-commit.png and b/img/branch-commit.png differ diff --git a/img/branch-create.png b/img/branch-create.png index 5bbe775f6aa9fce2b4602a0845eb2bd11eaf8a8d..bc5e5476089018f4b94363b5e376a7b17c54785c 100644 Binary files a/img/branch-create.png and b/img/branch-create.png differ diff --git a/slides/best_practices.md b/slides/best_practices.md index 2ee462cba34902476a1e4f02f3a869643e48a54f..6b6440ff8e9859cac52875cdf7d47ff9097b8143 100644 --- a/slides/best_practices.md +++ b/slides/best_practices.md @@ -3,7 +3,8 @@ * `clone` a repository, do not download the `.zip` file. * `pull` before `push` * Work on your **own** branch (in your own fork) -* Do **not** `push` to `master` or `develop` (submit PR) +* Do **not push** to `master` or `develop`, but **submit a PR** +* Get your code **reviewed** by your peers (submit a PR!) * Do **not** combine `git` commands ```sh $ git commit -am "myMessage" # do not do this @@ -14,9 +15,8 @@ $ git add myFile.txt ``` -* Commit only a few files at once -* Submit a PR instead of pushing directly -* Always sync your fork before starting to work +* Commit **only a few files** at once (after multiple separate `git add` commands) +* Always **sync your fork** before starting to work ```sh $ git remote -v # verify to have the right remote set $ git fetch upstream @@ -26,4 +26,4 @@ $ git push origin master # do not do git push (!) * `Push` often - avoid conflicts <br><br> -**A `push` a day keeps the conflict away** +Remember: **A `push` a day keeps conflicts away!** diff --git a/slides/branches.md b/slides/branches.md index 4cf120ff7cf7a69aa35ba99f3c1747ff84b3f64b..5e9ac0ed5140eb3b24f63598f0ab87f8da6e3433 100644 --- a/slides/branches.md +++ b/slides/branches.md @@ -9,13 +9,34 @@ The master branch: ## One branch per feature Assume that you want to work on a function for a matrix-vector operation. -```shell +```sh $ git checkout -b matrix_vect_mult_myName +# creates the branch locally ``` The `-b` flag creates the branch. <img src="img/branch-create.png" class="branch-create" /> +Push the branch to the remote repository +```sh +$ git push +``` + + +If you do that, `git` will complain +```sh +fatal: The current branch matrix_vect_mult_myName has no upstream branch. +To push the current branch and set the remote as upstream, use + + git push --set-upstream origin matrix_vect_mult_myName +``` + +<br> +Follow the advice and do: +```sh +$ git push --set-upstream origin matrix_vect_mult_myName +``` + ## Switch between branches @@ -23,7 +44,7 @@ In your terminal, you may see the name of the branch you are on. List available branches of the repository ```sh -$ git branch +$ git branch --list ``` <div class="fragment"> @@ -35,7 +56,7 @@ $ git checkout <branch_name> <div class="fragment"> <br> -You can switch back to master with +You can switch back to the `master` branch with ```sh $ git checkout master ``` @@ -51,38 +72,35 @@ Only difference: you are on your own branch. ## Merge a branch -If you want your feature on the `develop` or `master` branches, merge! - +If you want your feature 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" /> -<div class="fragment"> -**ADVANCED**: You can see the differences between branches -```sh -$ git diff master..matrix_vect_mult_myName -``` <br> -You can delete the branch via the interface. +Once merged, you can delete the branch via the interface. ## Gitlab interface -Detailed information is [docs.gitlab.com/ee/gitlab-basics/add-merge-request.html](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html). +Detailed information is [docs.gitlab.com/ce/gitlab-basics/add-merge-request.html](https://docs.gitlab.com/ce/gitlab-basics/add-merge-request.html). 1. Click on **New merge request** - + <br><br> 2. Compare the branches - + <ol start="3"> <li>Submit the MR - </li> + </li> </ol> @@ -92,15 +110,15 @@ Detailed information is [help.github.com/articles/creating-a-pull-request/](http 1. Click on **New pull request** - + <br><br> 2. Compare the branches - + <ol start="3"> - <li>Submit the MR + <li>Submit the PR - </li> + </li> </ol> diff --git a/slides/essential_commands.md b/slides/essential_commands.md index 2b29de7d5970cbee547b59515fcbca1e1eb51d93..944f03a70ac6c817e03a71ff073de37a1816ef05 100644 --- a/slides/essential_commands.md +++ b/slides/essential_commands.md @@ -7,7 +7,7 @@ `pull, status, add, commit, push` <br> -or in other words (remember these!) +or in other words (remember these!): ```shell $ git pull $ git status diff --git a/slides/forks.md b/slides/forks.md index 3fc815cbb52a264033276b9d41d3a4f0a7ecda1c..981bd6345b2b747062ab5e3b85b43057661b8519 100644 --- a/slides/forks.md +++ b/slides/forks.md @@ -5,14 +5,15 @@ You **fork** when you want to work on a public repository or a protected reposit Remember: - A **fork** is your own **copy** of a repository. -- A **fork** can have multiple **branches** +- A **fork** can have multiple **branches**. - A **fork** is not a **branch**, but can have multiple **branches**. -## Fork on GitLab +## Fork via interface +Browse to the original repository and click on the button `Fork`: -## Fork on GitHub + ## Clone your fork @@ -31,7 +32,7 @@ $ cd forkMyRepo ## Add the address of the original repository -Add the `upstream` (where you copied from) +Add the `upstream` address (original/protected repository) ```sh $ git remote add upstream https://git-r3lab.uni.lu/origGroup/origRepo.git ``` diff --git a/slides/github_gitlab.md b/slides/github_gitlab.md index 683c6757aefefc43902c85beb00301a3ce44c89b..a4b2cfb0477d88855fc9ba7f8ffb68eb417049f1 100644 --- a/slides/github_gitlab.md +++ b/slides/github_gitlab.md @@ -7,7 +7,14 @@ GitHub is **public**, whereas GitLab is **restricted/private**. Positive point: GitHub and GitLab are (almost) the same. -## GitHub +## GitHub (Live Demo) +[www.github.com](www.github.com) -## GitLab + +## GitLab (Live Demo) + +[https://git-r3lab.uni.lu](https://git-r3lab.uni.lu) + + +## Open an issue (Live Demo) diff --git a/slides/installation.md b/slides/installation.md index b33ba488830d5789c9c3f25e1446c07b402ccae7..ed949154118b7e24cca69c2818fa1c588817e38c 100644 --- a/slides/installation.md +++ b/slides/installation.md @@ -55,14 +55,14 @@ $ git --version Test whether your username and email have been registered ```sh -$ git config -l +$ git config --list ``` <br> This should list the configuration with `user.name` and `user.email`. -## I need `The COBRAToolbox` - How? +## I need `The COBRAToolbox`? Simply `clone` the repository (i.e., retrieve a copy) ```sh @@ -77,7 +77,7 @@ Any other rudimentary method such as shall **be avoided**! -## How do I `clone` a repository? +## How do I generally `clone` a repository? You can clone any other repository with: ```sh diff --git a/slides/overview.md b/slides/overview.md index f732a5b68300fa24a9cdf1788577d3ef2875f933..cfc6f802c2c923e0d4bc51222cf9d631ca7b9e89 100644 --- a/slides/overview.md +++ b/slides/overview.md @@ -8,6 +8,6 @@ * `clone/pull` / `status` / `add` / `commit` / `push` 5. Branches <!--(10 min)//--> 6. Forks <!--(10 min)//--> -7. Good practices +7. Best practices 8. Practical session <!--(40 min)//--> 9. Evaluation <!--(10 min)//--> diff --git a/slides/the_terminal.md b/slides/the_terminal.md index 23ebb3f0d5632c6930847a1bccaf1d0ba586a620..a4ead76803bd5d90a198ad859d4fd9e809b5a95e 100644 --- a/slides/the_terminal.md +++ b/slides/the_terminal.md @@ -1,4 +1,4 @@ -## The Linux Terminal +## The Terminal (shell) Starting the terminal presents itself with a line where you can enter a command: ```sh @@ -13,8 +13,8 @@ $ ``` <br> -When you open your terminal (git shell) and unless otherwise configured, you are located -in your home directory, denoted as `~/`. +When you open your terminal (shell), you are located +in your home directory (unless otherwise configured), denoted as `~/`. ## Essential Linux commands @@ -36,7 +36,10 @@ $ cd myDirectory Change the directory 1 level and 2 levels up ```sh $ cd .. +# 1 level up + $ cd ../.. +# 2 levels up ```