diff --git a/img/git_definition.png b/img/git_definition.png deleted file mode 100644 index 0676fc7a299fae5c7c3389eed91e21fcb050c629..0000000000000000000000000000000000000000 Binary files a/img/git_definition.png and /dev/null differ diff --git a/index.html b/index.html index baae7a5dde559de7ca56b6f924ccb822499633da..46454254d5405fb38683b9c29aff0d4221864140 100644 --- a/index.html +++ b/index.html @@ -81,6 +81,16 @@ + <section data-separator="^\n\n\n" + data-vertical="^\n\n" + data-background="../img/whiteBG.jpg" data-markdown="slides/why_use_git.md"></section> + + + + + + + <section data-separator="^\n\n\n" data-vertical="^\n\n" data-background="../img/whiteBG.jpg" data-markdown="slides/installation.md"></section> @@ -149,6 +159,16 @@ + + + <section data-separator="^\n\n\n" + data-vertical="^\n\n" + data-background="../img/whiteBG.jpg" data-markdown="slides/ready.md"></section> + + + + + </div> </div> diff --git a/slides/best_practices.md b/slides/best_practices.md index 6b6440ff8e9859cac52875cdf7d47ff9097b8143..684c5c0b0a53cad8c7db0434719c874c0cb0885c 100644 --- a/slides/best_practices.md +++ b/slides/best_practices.md @@ -6,23 +6,23 @@ * 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 -``` + ```bash + $ git commit -am "myMessage" # do not do this + ``` * Stage only 1 file at once using -```sh -$ git add myFile.txt -``` + ```bash + $ git add myFile.txt + ``` * 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 -$ git merge upstream/master -$ git push origin master # do not do git push (!) -``` + ```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/slides/branches.md b/slides/branches.md index 5e9ac0ed5140eb3b24f63598f0ab87f8da6e3433..622ae51b0c4d2217bd9fca7c9aaffda83a137107 100644 --- a/slides/branches.md +++ b/slides/branches.md @@ -2,14 +2,14 @@ Branch-off within the same repository in order to stay safe! -The master branch: +<br><br>The master branch <img src="img/branch-master.png" class="branch-master" /> ## One branch per feature Assume that you want to work on a function for a matrix-vector operation. -```sh +```bash $ git checkout -b matrix_vect_mult_myName # creates the branch locally ``` @@ -18,13 +18,13 @@ The `-b` flag creates the branch. <img src="img/branch-create.png" class="branch-create" /> Push the branch to the remote repository -```sh +```bash $ git push ``` -If you do that, `git` will complain -```sh +If you do that, `git` might complain +```bash fatal: The current branch matrix_vect_mult_myName has no upstream branch. To push the current branch and set the remote as upstream, use @@ -32,8 +32,8 @@ To push the current branch and set the remote as upstream, use ``` <br> -Follow the advice and do: -```sh +Follow the advice and do +```bash $ git push --set-upstream origin matrix_vect_mult_myName ``` @@ -43,21 +43,21 @@ $ git push --set-upstream origin matrix_vect_mult_myName In your terminal, you may see the name of the branch you are on. List available branches of the repository -```sh +```bash $ git branch --list ``` <div class="fragment"> <br> Checkout another branch -```sh +```bash $ git checkout <branch_name> ``` <div class="fragment"> <br> You can switch back to the `master` branch with -```sh +```bash $ git checkout master ``` @@ -85,8 +85,9 @@ Once merged, you can delete the branch via the interface. ## Gitlab interface +<img src="https://gitlab.com/gitlab-com/gitlab-artwork/raw/master/logo/logo.png" alt="GitLab" style="width: 100px;"/> -Detailed information is [docs.gitlab.com/ce/gitlab-basics/add-merge-request.html](https://docs.gitlab.com/ce/gitlab-basics/add-merge-request.html). +Detailed information is on [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** @@ -105,8 +106,9 @@ Detailed information is [docs.gitlab.com/ce/gitlab-basics/add-merge-request.html ## Github interface +<img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 100px;"/> -Detailed information is [help.github.com/articles/creating-a-pull-request/](https://help.github.com/articles/creating-a-pull-request/). +Detailed information is on [help.github.com/articles/creating-a-pull-request/](https://help.github.com/articles/creating-a-pull-request/). 1. Click on **New pull request** diff --git a/slides/essential_commands.md b/slides/essential_commands.md index 944f03a70ac6c817e03a71ff073de37a1816ef05..606266ffb170531ce218dec1d7b240d4f9c0dc7a 100644 --- a/slides/essential_commands.md +++ b/slides/essential_commands.md @@ -8,7 +8,7 @@ <br> or in other words (remember these!): -```shell +```bash $ git pull $ git status $ git add myFile.txt # example @@ -20,18 +20,18 @@ $ git push ## Pull the latest version of an existing repository First, browse to the cloned directory (`git clone [...]`): -```sh +```bash $ cd practice ``` Then, pull the latest revision: -```sh +```bash $ git pull # Already up to date ``` Verify its `status` with: -```sh +```bash $ git status ``` @@ -51,15 +51,15 @@ Then, uncomment the line <br> Save and rename the file by adding your name -```sh -mv firstCommit/addTwoNumbers.m firstCommit/addTwoNumbers_myName.m +```bash +$ mv firstCommit/addTwoNumbers.m firstCommit/addTwoNumbers_myName.m ``` ## Add your file to the stage First, check the repository status -```sh +```bash $ git status # uncommitted changes (displayed in red) ``` @@ -67,7 +67,7 @@ $ git status <div class="fragment"> <br> Now, add the file (bring it on stage) -```sh +```bash $ git add firstCommit/addTwoNumbers_myName.m #Â returns the same as before, generally in green (means staged) ``` @@ -75,7 +75,7 @@ $ git add firstCommit/addTwoNumbers_myName.m <div class="fragment"> <br> **ADVANCED**: see your changes in the terminal -```sh +```bash $ git diff ``` exit with `:q` @@ -83,34 +83,34 @@ exit with `:q` ## Add a commit message -```shell +```bash $ git commit -m "Uncommented line for adding 2 numbers" $ git status ``` <br> You can pull, even at this stage, new possible changes -```sh +```bash $ git pull ``` ## Push your file to the repository -```sh +```bash $ git push ``` <div class="fragment"> <br> **ADVANCED**: see the log of all the commits (and your last one) in the terminal -```sh +```bash $ git log ``` exit with `:q` -## Do it yourself: +## Do it yourself * Modify and rename `secondCommit/multiplyTwoNumbers.m` * Push the file `secondCommit/multiplyTwoNumbers_myName.m` @@ -118,7 +118,7 @@ exit with `:q` <div class="fragment"> <br> Commands: -```sh +```bash $ git pull $ git diff #Â optional $ git add secondCommit/multiplyTwoNumbers_myName.m diff --git a/slides/forks.md b/slides/forks.md index 981bd6345b2b747062ab5e3b85b43057661b8519..cdc7b67b5cc3e7864c71932fc162f228ae39006f 100644 --- a/slides/forks.md +++ b/slides/forks.md @@ -2,6 +2,7 @@ You **fork** when you want to work on a public repository or a protected repository. +<br><br> Remember: - A **fork** is your own **copy** of a repository. @@ -11,21 +12,21 @@ Remember: ## Fork via interface -Browse to the original repository and click on the button `Fork`: +Browse to the original repository and click on the button `Fork`  ## Clone your fork -Clone first: -```sh +Clone first +```bash $ git clone https://git-r3lab.uni.lu/myGroup/myRepo.git forkMyRepo ``` <br> -then, you can change to the directory: -```sh +then, you can change to the directory +```bash $ cd forkMyRepo ``` @@ -33,13 +34,13 @@ $ cd forkMyRepo ## Add the address of the original repository Add the `upstream` address (original/protected repository) -```sh +```bash $ git remote add upstream https://git-r3lab.uni.lu/origGroup/origRepo.git ``` <br> -You can then check whether the remote address is set correctly: -```sh +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" /> //--> @@ -49,7 +50,7 @@ $ git remote -v ## Synchronize your fork -```sh +```bash $ git checkout master $ git status ``` @@ -57,21 +58,21 @@ $ git status <div class="fragment"> <br> Fetch the changes from upstream (similar to pull) -```sh +```bash $ git fetch upstream ``` <div class="fragment"> <br> Merge the retrieved changes -```sh +```bash $ git merge upstream/master ``` <div class="fragment"> <br> -Push the changes to your own fork: -```sh +Push the changes to your own fork +```bash $ git push origin master ``` diff --git a/slides/github_gitlab.md b/slides/github_gitlab.md index a4b2cfb0477d88855fc9ba7f8ffb68eb417049f1..ea5e300d8dee6246fb4012881022f15abd4b9b2e 100644 --- a/slides/github_gitlab.md +++ b/slides/github_gitlab.md @@ -1,5 +1,8 @@ ## 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**. @@ -10,11 +13,13 @@ Positive point: GitHub and GitLab are (almost) the same. ## GitHub (Live Demo) [www.github.com](www.github.com) +<br><img src="https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" style="width: 200px;"/> ## GitLab (Live Demo) [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;"/> ## Open an issue (Live Demo) diff --git a/slides/installation.md b/slides/installation.md index ed949154118b7e24cca69c2818fa1c588817e38c..ba60959775dc78b3e3f65287c9139d414dc1d01f 100644 --- a/slides/installation.md +++ b/slides/installation.md @@ -4,8 +4,8 @@ **Linux (Ubuntu)** -```sh -sudo apt-get install git-all +```bash +$ sudo apt-get install git-all ``` <br> **macOS** @@ -36,7 +36,7 @@ Start `GUI Bash` or `MobaXTerm`. ## How to configure `git`? -```shell +```bash $ git config --global user.name "Firstname Lastname" $ git config --global user.email "first.last@uni.lu" ``` @@ -44,7 +44,7 @@ $ git config --global user.email "first.last@uni.lu" ## Does it work? -```sh +```bash $ git --version # git version 2.10.0 ``` @@ -54,7 +54,7 @@ $ git --version Test whether your username and email have been registered -```sh +```bash $ git config --list ``` @@ -65,7 +65,7 @@ This should list the configuration with `user.name` and `user.email`. ## I need `The COBRAToolbox`? Simply `clone` the repository (i.e., retrieve a copy) -```sh +```bash $ git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox ``` @@ -79,15 +79,15 @@ shall **be avoided**! ## How do I generally `clone` a repository? -You can clone any other repository with: -```sh +You can clone any other repository with +```bash $ git clone https://github.com/userName/myRepo.git myRepo ``` <div class="fragment"> <br> -Clone the training repository with: -```sh +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. diff --git a/slides/list.json b/slides/list.json index 3dd91a69ad4768b5ea07c3f8da6cea90a0377624..eaa96734b211027b930937950a0663fedcb4f60d 100644 --- a/slides/list.json +++ b/slides/list.json @@ -23,6 +23,12 @@ "data-background": "../img/whiteBG.jpg" } }, + { + "filename": "why_use_git.md", + "attr": { + "data-background": "../img/whiteBG.jpg" + } + }, { "filename": "installation.md", "attr": { @@ -64,5 +70,11 @@ "attr": { "data-background": "../img/whiteBG.jpg" } + }, + { + "filename": "ready.md", + "attr": { + "data-background": "../img/whiteBG.jpg" + } } ] diff --git a/slides/ready.md b/slides/ready.md new file mode 100644 index 0000000000000000000000000000000000000000..118f9786b608e6916028c7be1acdb830cc089b59 --- /dev/null +++ b/slides/ready.md @@ -0,0 +1,5 @@ +## Ready for a practice!!! + +<br>Go to https://github.com/uni-lu/group_members + +<br>And follow the `README` file. diff --git a/slides/thanks.md b/slides/thanks.md index e234bf21c538823f7957f8c188002c296e6752bf..4f65b5d21da4dd42746de529b2f2e0103a140140 100644 --- a/slides/thanks.md +++ b/slides/thanks.md @@ -1,15 +1,11 @@ -## References +### References -[1]: **Git** Book: https://git-scm.com/book/en/v2 +[1]: **Git** Book: +https://git-scm.com/book/en/v2 +<br>[2]: GitHub training services: https://services.github.com/training/ -## Acknowledgement -Laurent Heirendt +### Cheat sheet +[Web](http://rogerdudler.github.io/git-guide/index.html) or [PDF](http://rogerdudler.github.io/git-guide/files/git_cheat_sheet.pdf) - - -Sylvain Arreckx - - -Cheat sheet : [Web](http://rogerdudler.github.io/git-guide/index.html) or [PDF](http://rogerdudler.github.io/git-guide/files/git_cheat_sheet.pdf) prepared by [@rogerdudler](https://github.com/rogerdudler) diff --git a/slides/the_terminal.md b/slides/the_terminal.md index a4ead76803bd5d90a198ad859d4fd9e809b5a95e..833454e72d4ab31854d4b849ec5e87519d243d4e 100644 --- a/slides/the_terminal.md +++ b/slides/the_terminal.md @@ -1,14 +1,14 @@ ## The Terminal (shell) -Starting the terminal presents itself with a line where you can enter a command: -```sh +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: -```sh +Often written, for covenience, as +```bash $ ``` @@ -20,21 +20,21 @@ in your home directory (unless otherwise configured), denoted as `~/`. ## Essential Linux commands List the contents of a directory -```sh +```bash $ ls ``` <div class="fragment"> <br> Change the directory to a specific folder -```sh +```bash $ cd myDirectory ``` <div class="fragment"> <br> Change the directory 1 level and 2 levels up -```sh +```bash $ cd .. # 1 level up @@ -45,20 +45,20 @@ $ cd ../.. <br> Create a directory -```sh +```bash $ mkdir myNewDirectory ``` <div class="fragment"> <br> Move a file or a directory -```sh +```bash $ mv myFile.m myDirectory/. ``` <div class="fragment"> <br> Rename a file or a directory -```sh +```bash $ mv myFile.m myNewFile.m ``` diff --git a/slides/what_is_git.md b/slides/what_is_git.md index 44347eed70d4fbbc10d2ac5fdeed14f94d0cedd7..378da33ee52e2766833d2e1fe27c1ec5e7a14bc1 100644 --- a/slides/what_is_git.md +++ b/slides/what_is_git.md @@ -1,10 +1,10 @@ ## 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]. -Designed and implemented in 2005 by **Linus Torvalds** +<br><br><br>Designed and implemented in 2005 by **Linus Torvalds**  diff --git a/slides/why_use_git.md b/slides/why_use_git.md new file mode 100644 index 0000000000000000000000000000000000000000..ebbdd10c371d72e40d451f2a5b5603a509a3c614 --- /dev/null +++ b/slides/why_use_git.md @@ -0,0 +1,12 @@ +# Why use git? + +* No need to fully rewrite code; reuse code and save time. +* Keep the changes you made over time +* Allow you to backtrack (if necessary) and undo those 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.