Commit e1f2321c authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

Changes to slides

parent f1288d0c
......@@ -7,7 +7,7 @@
`pull, status, add, commit, push`
<br>
or in other words (more technically)
or in other words (remember these!)
```shell
$ git pull
$ 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
$ cd
$ mkdir workspace
$ cd workspace
```
Puis le dossier du nouveau projet
<br>
Open the file `addTwoNumbers.m` in the folder `firstCommit` using the `Atom` editor (or any other editor).
```shell
$ mkdir listes
$ cd listes
$ git init
<br>
Then, uncomment the line
```Matlab
% 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">
```shell
First, check the repository status
```sh
$ git status
# uncommitted changes (displayed in red)
```
<div class="fragment">
```shell
$ git add courses.txt
$ git status
<br>
Now, add the file (bring it on stage)
```sh
$ git add firstCommit/addTwoNumbers_myName.m
# returns the same as before, generally in green (means staged)
```
<div class="fragment">
```shell
$ git commit -m "Creation de la liste de courses"
$ git status
<br>
**ADVANCED**: see your changes in the terminal
```sh
$ git diff
```
note:
Pas besoin de serveur, pas besoin de connexion Internet
exit with `:q`
## Modification de fichier
## Add a commit message
Modifier le fichier `courses.txt`
<div class="fragment">
```shell
$ git commit -m "Uncommented line for adding 2 numbers"
$ git status
```
<div class="fragment">
```shell
$ git diff courses.txt
<br>
You can pull, even at this stage, new possible changes
```sh
$ git pull
```
<div class="fragment">
```shell
$ git add courses.txt
$ git status
```
<div class="fragment">
```shell
$ git commit -m "Ajout du beurre"
$ git status
## Push your file to the folder
```sh
$ git push
```
<div class="fragment">
```shell
<br>
**ADVANCED**: see the log of all the commits (and your last one) in the terminal
```sh
$ git log
```
exit with `:q`
## Que s'est-il passé ?
## Espace de travail
_working directory_
```shell
$ git status
# Changes not staged for commit:
```
## Zone de transit
## Do it yourself:
_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
# 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)
$ git clone https://github.com/opencobra/cobratoolbox.git cobratoolbox
```
<br>
Any other rudimentary method such as
*'I simply download the `.zip` un unzip it - works like a charm!'*
......@@ -85,6 +86,7 @@ You can clone any other repository with:
$ git clone https://github.com/userName/myRepo.git myRepo
```
<div class="fragment">
<br>
Clone the training repository with:
```sh
......
......@@ -53,6 +53,12 @@
"data-background": "../img/whiteBG.jpg"
}
},
{
"filename": "good_practices.md",
"attr": {
"data-background": "../img/whiteBG.jpg"
}
},
{
"filename": "thanks.md",
"attr": {
......
......@@ -5,8 +5,9 @@
2. GitHub and GitLab <!--(5min)//-->
3. Installation of `git`
4. The 5 essential commands <!--(10 min)//-->
- `clone/pull` / `status` / `add` / `commit` / `push`
* `clone/pull` / `status` / `add` / `commit` / `push`
5. Branches <!--(10 min)//-->
6. Forks <!--(10 min)//-->
7. Practical session <!--(40 min)//-->
8. Evaluation <!--(10 min)//-->
7. Good practices
8. Practical session <!--(40 min)//-->
9. Evaluation <!--(10 min)//-->
# References
## References
[1]: **Git** Book: https://git-scm.com/book/en/v2
# Acknowledgement
## Acknowledgement
Laurent Heirendt
......
......@@ -4,32 +4,59 @@ Starting the terminal presents itself with a line where you can enter a command:
```sh
cesar@myComputer>
```
<div class="fragment">
<br>
Often written, for covenience, as:
```sh
$
```
<br>
When you open your terminal (git shell) and unless otherwise configured, you are located
in your home directory, denoted as `~/`.
## Essential Linux commands
<div class="fragment">
List the contents of a directory
```sh
$ ls
```
<div class="fragment">
<br>
Change the directory to a specific folder
```sh
$ cd myDirectory
```
<div class="fragment">
<br>
Change the directory 1 level and 2 levels up
```sh
$ cd ..
$ cd ../..
```
<div class="fragment">
<br>
Create a directory
```sh
$ 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
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment