From fcccdcd9510829aef14ddd03272d178666a2e59a Mon Sep 17 00:00:00 2001 From: Laurent Heirendt <laurent.heirendt@uni.lu> Date: Mon, 16 Jan 2017 17:43:35 +0100 Subject: [PATCH] Minor changes to slides --- best_practices.md | 11 +++++------ branches.md | 29 +++++++++++++++++++++++++---- forks.md | 4 ++-- github_gitlab.md | 4 ++++ the_terminal.md | 9 ++++++--- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/best_practices.md b/best_practices.md index 5b9c42ba..6b6440ff 100644 --- a/best_practices.md +++ b/best_practices.md @@ -3,8 +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) -* Get your code reviewed by submitted a 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 @@ -15,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 @@ -27,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/branches.md b/branches.md index 9cf292a5..5e9ac0ed 100644 --- a/branches.md +++ b/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 ``` @@ -60,7 +81,7 @@ Use the **interface** to make use of your peers to review your code! <img src="img/branch-merge.png" class="branch-merge" /> <br> -You can delete the branch via the interface. +Once merged, you can delete the branch via the interface. ## Gitlab interface diff --git a/forks.md b/forks.md index 28992904..981bd634 100644 --- a/forks.md +++ b/forks.md @@ -5,7 +5,7 @@ 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**. @@ -32,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/github_gitlab.md b/github_gitlab.md index ee7d8a57..a4b2cfb0 100644 --- a/github_gitlab.md +++ b/github_gitlab.md @@ -9,8 +9,12 @@ Positive point: GitHub and GitLab are (almost) the same. ## GitHub (Live Demo) +[www.github.com](www.github.com) + ## GitLab (Live Demo) +[https://git-r3lab.uni.lu](https://git-r3lab.uni.lu) + ## Open an issue (Live Demo) diff --git a/the_terminal.md b/the_terminal.md index 23ebb3f0..a4ead768 100644 --- a/the_terminal.md +++ b/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 ``` -- GitLab