Skip to content
Snippets Groups Projects
Commit 49ffd517 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

merged

parents 3dcae83e 83f6eb1e
No related branches found
No related tags found
No related merge requests found
Pipeline #12458 passed
...@@ -43,6 +43,6 @@ build_artifacts: ...@@ -43,6 +43,6 @@ build_artifacts:
- make - make
artifacts: artifacts:
paths: paths:
- "*.pdf" - "git_tutorial.pdf"
only: only:
- tags - tags
BEAMEROPTIONS = -t beamer BEAMEROPTIONS = -t beamer
BEAMEROPTIONS += --pdf-engine=pdflatex BEAMEROPTIONS += --pdf-engine=xelatex
BEAMEROPTIONS += --default-image-extension=pdf BEAMEROPTIONS += --default-image-extension=pdf
BEAMEROPTIONS += -V theme:metropolis BEAMEROPTIONS += -V theme:metropolis
BEAMEROPTIONS += -V themeoptions:numbering=none -V themeoptions:progressbar=foot BEAMEROPTIONS += -V themeoptions:numbering=none -V themeoptions:progressbar=foot
BEAMEROPTIONS += -V fontsize=smaller BEAMEROPTIONS += -V fontsize=smaller
BEAMEROPTIONS += --highlight-style espresso BEAMEROPTIONS += --highlight-style espresso
BEAMEROPTIONS += -H ./header.tex --listings
BLA = $(shell git log | head -n 1)
default: git_tutorial.md default: git_tutorial.md
echo $(BLA)
sed -i '3s/.*/% $(BLA)/' git_tutorial.md
pandoc -s $(BEAMEROPTIONS) -o git_tutorial.pdf git_tutorial.md pandoc -s $(BEAMEROPTIONS) -o git_tutorial.pdf git_tutorial.md
deploy: default deploy: default
......
% Introduction à Git % Introduction à Git
% Orestis Malaspinas % Orestis Malaspinas
% Version 6a487a9ed53c19b24e7b3dc0cff9a38896ccf666 % commit 3dcae83e4de3ce77d6b0bc1e2a6d63fb2da6e101
# Des références # Des références
...@@ -12,7 +12,7 @@ Il existe énormément de très bons documents et tutoriels en ligne: ...@@ -12,7 +12,7 @@ Il existe énormément de très bons documents et tutoriels en ligne:
Des tas de repo en ligne: Des tas de repo en ligne:
- [Githepia](https://githepia.hesge.ch) - [Githepia](https://githepia.hesge.ch)
- [Githhub](https://www.github.com) - [Github](https://www.github.com)
- [Gitlab](https://www.gitlab.com) - [Gitlab](https://www.gitlab.com)
Et des GUI assez utiles: Et des GUI assez utiles:
...@@ -25,10 +25,10 @@ Et des GUI assez utiles: ...@@ -25,10 +25,10 @@ Et des GUI assez utiles:
- Git est un outil de gestion de versions (dév. par L. Torvalds). - Git est un outil de gestion de versions (dév. par L. Torvalds).
* Cela évite d'avoir à gérer les fichiers d'un projet comme: * Cela évite d'avoir à gérer les fichiers d'un projet comme:
- fichier.c - fichier.c
- fichier_10_3_2018.c - fichier_10_3_2019.c
- fichier_10_3_2018_16h.c - fichier_10_3_2019_16h.c
- fichier_10_3_2018_16h_Malaspinas.c - fichier_10_3_2019_16h_Malaspinas.c
- fichier_10_3_2018_16h_Gluck.c - fichier_10_3_2019_16h_Antoniadis.c
* L'historique est accessible à tout moment. * L'historique est accessible à tout moment.
* Difficile d'écraser le mauvais fichier lors d'une synchronisation. * Difficile d'écraser le mauvais fichier lors d'une synchronisation.
- Possibilité de découpler le développement dans un projet. - Possibilité de découpler le développement dans un projet.
...@@ -55,7 +55,7 @@ Typiquement un projet git possède un serveur "officiel" géré par l'administra ...@@ -55,7 +55,7 @@ Typiquement un projet git possède un serveur "officiel" géré par l'administra
1. Création d'un dépôt *tutorial* git sur [https://githepia.hesge.ch](https://githepia.hesge.ch). 1. Création d'un dépôt *tutorial* git sur [https://githepia.hesge.ch](https://githepia.hesge.ch).
2. Clone du dépôt. 2. Clone du dépôt.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
$ git clone ssh://git@ssh.hesge.ch:10572/orestis.malaspin/tutorial.git $ git clone ssh://git@ssh.hesge.ch:10572/orestis.malaspin/tutorial.git
Cloning into 'tutorial'... Cloning into 'tutorial'...
warning: You appear to have cloned an empty repository. warning: You appear to have cloned an empty repository.
...@@ -73,7 +73,7 @@ $ cd tutorial ...@@ -73,7 +73,7 @@ $ cd tutorial
2. Ajout du `premierfichier.c` aux fichiers suivis par git. 2. Ajout du `premierfichier.c` aux fichiers suivis par git.
3. *Commit* du fichier ajouté à l'historique des modifications. 3. *Commit* du fichier ajouté à l'historique des modifications.
4. *Push* de l'état de l'historique sur le serveur. 4. *Push* de l'état de l'historique sur le serveur.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ echo Hello World > premierfichier.c [tutorial]$ echo Hello World > premierfichier.c
[tutorial]$ git status [tutorial]$ git status
On branch master On branch master
...@@ -93,7 +93,7 @@ nothing added to commit but untracked files present (use "git add" to track) ...@@ -93,7 +93,7 @@ nothing added to commit but untracked files present (use "git add" to track)
## Commandes: `git add`, `git status`, `git commit`, `git push` ## Commandes: `git add`, `git status`, `git commit`, `git push`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ git add premierfichier.c [tutorial]$ git add premierfichier.c
[tutorial]$ git status [tutorial]$ git status
On branch master On branch master
...@@ -115,7 +115,7 @@ Changes to be committed: ...@@ -115,7 +115,7 @@ Changes to be committed:
## Commandes: `git add`, `git status`, `git commit`, `git push` ## Commandes: `git add`, `git status`, `git commit`, `git push`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ git status [tutorial]$ git status
On branch master On branch master
Your branch is based on 'origin/master', but the upstream is gone. Your branch is based on 'origin/master', but the upstream is gone.
...@@ -152,7 +152,7 @@ To ssh://ssh.hesge.ch:10572/orestis.malaspin/tutorial.git ...@@ -152,7 +152,7 @@ To ssh://ssh.hesge.ch:10572/orestis.malaspin/tutorial.git
1. Modification du fichier `premierfichier.c`. 1. Modification du fichier `premierfichier.c`.
2. Ajout/commit/push des modifictations. 2. Ajout/commit/push des modifictations.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ echo Wild World > premierfichier.c [tutorial]$ echo Wild World > premierfichier.c
[tutorial]$ git status [tutorial]$ git status
On branch master On branch master
...@@ -171,7 +171,7 @@ no changes added to commit (use "git add" and/or "git commit -a") ...@@ -171,7 +171,7 @@ no changes added to commit (use "git add" and/or "git commit -a")
## Commandes: `git diff`, `git log` ## Commandes: `git diff`, `git log`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ git diff [tutorial]$ git diff
diff --git a/premierfichier.c b/premierfichier.c diff --git a/premierfichier.c b/premierfichier.c
index 557db03..9622e40 100644 index 557db03..9622e40 100644
...@@ -195,7 +195,7 @@ To ssh://ssh.hesge.ch:10572/orestis.malaspin/tutorial.git ...@@ -195,7 +195,7 @@ To ssh://ssh.hesge.ch:10572/orestis.malaspin/tutorial.git
## Commandes: `git diff`, `git log` ## Commandes: `git diff`, `git log`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ git log [tutorial]$ git log
commit f9ab3ec4a00c46a12d7a45f133295acc5fb5cd20 (HEAD -> master, origin/master) commit f9ab3ec4a00c46a12d7a45f133295acc5fb5cd20 (HEAD -> master, origin/master)
Author: Orestis Malaspinas <orestis.malaspinas@hesge.ch> Author: Orestis Malaspinas <orestis.malaspinas@hesge.ch>
...@@ -214,11 +214,11 @@ Date: Sun Mar 4 22:25:24 2018 +0100 ...@@ -214,11 +214,11 @@ Date: Sun Mar 4 22:25:24 2018 +0100
## Commandes: `git checkout`, `git reset` ## Commandes: `git checkout`, `git reset`
1. Faire une modification dans un fichier qu'on aurait pas voulu faire. 1. Faire une modification dans un fichier par erreur.
2. Faire un `git add` qu'on aurait pas dû faire. 2. Faire un `git add` par erreur.
3. Faire un `git commit` qu'on aurait pas dû faire. 3. Faire un `git commit` par erreur.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ echo Oh no! An awful modification! > premierfichier.c [tutorial]$ echo Oh no! An awful modification! > premierfichier.c
[tutorial]$ git status [tutorial]$ git status
On branch master On branch master
...@@ -237,10 +237,10 @@ no changes added to commit (use "git add" and/or "git commit -a") ...@@ -237,10 +237,10 @@ no changes added to commit (use "git add" and/or "git commit -a")
## Commandes: `git checkout`, `git reset` ## Commandes: `git checkout`, `git reset`
### Une modification dans un fichier qu'on aurait pas voulu faire. ### Une modification dans un fichier par erreur
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ git checkout premierfichier.c [tutorial]$ git checkout premierfichier.c
[tutorial]$ git status [tutorial]$ git status
On branch master On branch master
Your branch is up to date with 'origin/master'. Your branch is up to date with 'origin/master'.
...@@ -253,9 +253,9 @@ nothing to commit, working tree clean ...@@ -253,9 +253,9 @@ nothing to commit, working tree clean
## Commandes: `git checkout`, `git reset` ## Commandes: `git checkout`, `git reset`
### Faire un `git add` qu'on aurait pas dû faire. ### Faire un `git add` par erreur (1/2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ echo Oh no! An awful modification! > premierfichier.c [tutorial]$ echo Oh no! An awful modification! > premierfichier.c
[tutorial]$ git add premierfichier.c [tutorial]$ git add premierfichier.c
[tutorial]$ git status [tutorial]$ git status
...@@ -275,9 +275,9 @@ M premierfichier.c ...@@ -275,9 +275,9 @@ M premierfichier.c
## Commandes: `git checkout`, `git reset` ## Commandes: `git checkout`, `git reset`
### Faire un `git add` qu'on aurait pas dû faire. ### Faire un `git add` par erreur (2/2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ git status [tutorial]$ git status
On branch master On branch master
Your branch is up to date with 'origin/master'. Your branch is up to date with 'origin/master'.
...@@ -303,9 +303,9 @@ index 9622e40..cfd5469 100644 ...@@ -303,9 +303,9 @@ index 9622e40..cfd5469 100644
## Commandes: `git checkout`, `git reset` ## Commandes: `git checkout`, `git reset`
### Faire un `git commit` qu'on aurait pas dû faire. ### Faire un `git commit` par erreur (1/2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ git commit -am "troisieme commit" [tutorial]$ git commit -am "troisieme commit"
[master 0563c02] troisieme commit [master 0563c02] troisieme commit
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
...@@ -327,9 +327,9 @@ no changes added to commit ...@@ -327,9 +327,9 @@ no changes added to commit
## Commandes: `git checkout`, `git reset` ## Commandes: `git checkout`, `git reset`
### Faire un `git commit` qu'on aurait pas dû faire. ### Faire un `git commit` par erreur (2/2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[tutorial]$ echo Wonderful World > premierfichier.c [tutorial]$ echo Wonderful World > premierfichier.c
[tutorial]$ git commit -am "la bonne troisieme modification" [tutorial]$ git commit -am "la bonne troisieme modification"
[master 1b42970] la bonne troisieme modification [master 1b42970] la bonne troisieme modification
...@@ -352,12 +352,12 @@ Automatic merge failed; fix conflicts and then commit the result. ...@@ -352,12 +352,12 @@ Automatic merge failed; fix conflicts and then commit the result.
# Retirer un fichier du contrôle de version (1/3) # Retirer un fichier du contrôle de version (1/3)
## Commande: `git rm` ## Commande: `git rm`
- Il n'est plus nécessaire de suivre un fichier. - Il n'est plus nécessaire de suivre un fichier.
- **Attention**: le fichier ne disparaît pas de l'historique. - **Attention : le fichier ne disparaît pas de l'historique.**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[malaspor@perka tutorial]$ git rm premierfichier.c [malaspor@perka tutorial]$ git rm premierfichier.c
rm 'premierfichier.c' rm 'premierfichier.c'
[malaspor@perka tutorial]$ git status [malaspor@perka tutorial]$ git status
On branch master On branch master
...@@ -375,9 +375,9 @@ Changes to be committed: ...@@ -375,9 +375,9 @@ Changes to be committed:
# Retirer un fichier du contrôle de version (2/3) # Retirer un fichier du contrôle de version (2/3)
## Commande: `git rm` ## Commande: `git rm` (1/2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[malaspor@perka tutorial]$ ls -ltr [malaspor@perka tutorial]$ ls -ltr
total 0 total 0
[malaspor@perka tutorial]$ git reset bbb151324289dc2f85468f5721ec1021692dd216 [malaspor@perka tutorial]$ git reset bbb151324289dc2f85468f5721ec1021692dd216
...@@ -398,11 +398,11 @@ no changes added to commit (use "git add" and/or "git commit -a") ...@@ -398,11 +398,11 @@ no changes added to commit (use "git add" and/or "git commit -a")
# Retirer un fichier du contrôle de version (3/3) # Retirer un fichier du contrôle de version (3/3)
## Commande: `git rm` ## Commande: `git rm` (2/2)
On peut retrouver le fichier dans l'historique. On peut retrouver le fichier dans l'historique.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash}
[malaspor@perka tutorial]$ ls -ltr [malaspor@perka tutorial]$ ls -ltr
total 0 total 0
[malaspor@perka tutorial]$ git checkout premierfichier.c [malaspor@perka tutorial]$ git checkout premierfichier.c
...@@ -419,6 +419,9 @@ Il existe une **grande quantité** de fonctionnalités non discutées ici: ...@@ -419,6 +419,9 @@ Il existe une **grande quantité** de fonctionnalités non discutées ici:
2. `git branch` 2. `git branch`
3. `git merge` 3. `git merge`
4. `git tag` 4. `git tag`
**ET SURTOUT:**
5. `git trois-lignes-de-commandes-incompréhensibles-que-seul stackoverflow-peut-vous-permettre-d'écrire` 5. `git trois-lignes-de-commandes-incompréhensibles-que-seul stackoverflow-peut-vous-permettre-d'écrire`
......
\lstset{
basicstyle=\fontsize{7}{7}\ttfamily,
keywordstyle=\color[rgb]{0.13,0.29,0.53}\bfseries,
stringstyle=\color[rgb]{0.31,0.60,0.02},
commentstyle=\color[rgb]{0.56,0.35,0.01}\itshape,
backgroundcolor=\color[RGB]{238,238,238},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=4,
captionpos=b,
breaklines=true,
extendedchars=true,
columns=fixed,
frame=trbl,
framesep=4pt,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment