Skip to content
Snippets Groups Projects
Commit e1f2321c authored by Laurent Heirendt's avatar Laurent Heirendt :airplane:
Browse files

Changes to slides

parent f1288d0c
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
`pull, status, add, commit, push` `pull, status, add, commit, push`
<br> <br>
or in other words (more technically) or in other words (remember these!)
```shell ```shell
$ git pull $ git pull
$ git status $ git status
...@@ -36,100 +36,94 @@ $ git status ...@@ -36,100 +36,94 @@ $ git status
``` ```
## Creat ## Modify a file
Créer l'espace de travail Modify and rename `addTwoNumbers.m` in the folder `firstCommit`
```shell <br>
$ cd Open the file `addTwoNumbers.m` in the folder `firstCommit` using the `Atom` editor (or any other editor).
$ mkdir workspace
$ cd workspace
```
Puis le dossier du nouveau projet
```shell <br>
$ mkdir listes Then, uncomment the line
$ cd listes ```Matlab
$ git init % c = a + b
``` ```
<br>
Save and rename the file by adding your name
```sh
mv firstCommit/addTwoNumbers.m firstCommit/addTwoNumbers_myName.m
```
## Nouveau fichier
Créer le fichier `courses.txt` ## Add your file to the stage
<div class="fragment"> First, check the repository status
```shell ```sh
$ git status $ git status
# uncommitted changes (displayed in red)
``` ```
<div class="fragment"> <div class="fragment">
```shell <br>
$ git add courses.txt Now, add the file (bring it on stage)
$ git status ```sh
$ git add firstCommit/addTwoNumbers_myName.m
# returns the same as before, generally in green (means staged)
``` ```
<div class="fragment"> <div class="fragment">
```shell <br>
$ git commit -m "Creation de la liste de courses" **ADVANCED**: see your changes in the terminal
$ git status ```sh
$ git diff
``` ```
exit with `:q`
note:
Pas besoin de serveur, pas besoin de connexion Internet
## Modification de fichier ## Add a commit message
Modifier le fichier `courses.txt`
<div class="fragment">
```shell ```shell
$ git commit -m "Uncommented line for adding 2 numbers"
$ git status $ git status
``` ```
<div class="fragment"> <br>
```shell You can pull, even at this stage, new possible changes
$ git diff courses.txt ```sh
$ git pull
``` ```
<div class="fragment">
```shell
$ git add courses.txt
$ git status
```
<div class="fragment"> ## Push your file to the folder
```shell
$ git commit -m "Ajout du beurre" ```sh
$ git status $ git push
``` ```
<div class="fragment"> <div class="fragment">
```shell <br>
**ADVANCED**: see the log of all the commits (and your last one) in the terminal
```sh
$ git log $ git log
``` ```
exit with `:q`
## Que s'est-il passé ? ## Do it yourself:
## Espace de travail
_working directory_
```shell
$ git status
# Changes not staged for commit:
```
## Zone de transit
_index_ ou _staging area_ * Modify and rename `secondCommit/multiplyTwoNumbers.m`
* Push the file `secondCommit/multiplyTwoNumbers_myName.m`
```shell <div class="fragment">
<br>
Commands:
```sh
$ git pull
$ git diff # optional
$ git add secondCommit/multiplyTwoNumbers_myName.m
$ git commit -m "Uncommented line for multiplying 2 numbers"
$ git status $ git status
# Changes to be commited: $ git push
$ git log # optional
``` ```
## Good practices
1. `clone` a repository, do not download the `.zip` file.
2. `pull` before `push`
3. Work on your own branch (in your own fork)
4. Do not `push` to `master`
5. Do not `push` to `develop`
6. Stage only 1 file at once using
```sh
$ git add myFile.txt
```
7. Commit only a few files at once
8. Submit a PR instead of pushing directly
9. Always sync your fork before starting to work
10. `Push` often - avoid conflicts
<br><br>
**A `push` a day keeps the conflict away**
...@@ -71,6 +71,7 @@ Simply `clone` the repository (i.e., retrieve a copy) ...@@ -71,6 +71,7 @@ Simply `clone` the repository (i.e., retrieve a copy)
$ git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox $ git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox
``` ```
<br>
Any other rudimentary method such as Any other rudimentary method such as
*'I simply download the `.zip` un unzip it - works like a charm!'* *'I simply download the `.zip` un unzip it - works like a charm!'*
...@@ -85,6 +86,7 @@ You can clone any other repository with: ...@@ -85,6 +86,7 @@ You can clone any other repository with:
$ git clone https://github.com/userName/myRepo.git myRepo $ git clone https://github.com/userName/myRepo.git myRepo
``` ```
<div class="fragment">
<br> <br>
Clone the training repository with: Clone the training repository with:
```sh ```sh
......
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
"data-background": "../img/whiteBG.jpg" "data-background": "../img/whiteBG.jpg"
} }
}, },
{
"filename": "good_practices.md",
"attr": {
"data-background": "../img/whiteBG.jpg"
}
},
{ {
"filename": "thanks.md", "filename": "thanks.md",
"attr": { "attr": {
......
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
2. GitHub and GitLab <!--(5min)//--> 2. GitHub and GitLab <!--(5min)//-->
3. Installation of `git` 3. Installation of `git`
4. The 5 essential commands <!--(10 min)//--> 4. The 5 essential commands <!--(10 min)//-->
- `clone/pull` / `status` / `add` / `commit` / `push` * `clone/pull` / `status` / `add` / `commit` / `push`
5. Branches <!--(10 min)//--> 5. Branches <!--(10 min)//-->
6. Forks <!--(10 min)//--> 6. Forks <!--(10 min)//-->
7. Practical session <!--(40 min)//--> 7. Good practices
8. Evaluation <!--(10 min)//--> 8. Practical session <!--(40 min)//-->
9. Evaluation <!--(10 min)//-->
# References ## References
[1]: **Git** Book: https://git-scm.com/book/en/v2 [1]: **Git** Book: https://git-scm.com/book/en/v2
# Acknowledgement ## Acknowledgement
Laurent Heirendt Laurent Heirendt
......
...@@ -4,32 +4,59 @@ Starting the terminal presents itself with a line where you can enter a command: ...@@ -4,32 +4,59 @@ Starting the terminal presents itself with a line where you can enter a command:
```sh ```sh
cesar@myComputer> cesar@myComputer>
``` ```
<div class="fragment">
<br>
Often written, for covenience, as: Often written, for covenience, as:
```sh ```sh
$ $
``` ```
<br>
When you open your terminal (git shell) and unless otherwise configured, you are located When you open your terminal (git shell) and unless otherwise configured, you are located
in your home directory, denoted as `~/`. in your home directory, denoted as `~/`.
## Essential Linux commands ## Essential Linux commands
<div class="fragment">
List the contents of a directory List the contents of a directory
```sh ```sh
$ ls $ ls
``` ```
<div class="fragment">
<br>
Change the directory to a specific folder Change the directory to a specific folder
```sh ```sh
$ cd myDirectory $ cd myDirectory
``` ```
<div class="fragment">
<br>
Change the directory 1 level and 2 levels up Change the directory 1 level and 2 levels up
```sh ```sh
$ cd .. $ cd ..
$ cd ../.. $ cd ../..
``` ```
<div class="fragment">
<br>
Create a directory Create a directory
```sh ```sh
$ mkdir myNewDirectory $ mkdir myNewDirectory
``` ```
<div class="fragment">
<br>
Move a file or a directory
```sh
$ mv myFile.m myDirectory/.
```
<div class="fragment">
<br>
Rename a file or a directory
```sh
$ mv myFile.m myNewFile.m
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment