diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a64777249d9ac44e3723cb100f4568f9099ac01..59c266181d1b0031e817c7c045b2aec1db5ddb6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,6 +43,6 @@ build_artifacts: - make artifacts: paths: - - "*.pdf" + - "git_tutorial.pdf" only: - tags diff --git a/Makefile b/Makefile index 7de2b93c6d5ae34acd9d09c28df9b6e1e84c96fa..0346b8a4bd1e6781f851a3de01d4576e367cc575 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,17 @@ BEAMEROPTIONS = -t beamer -BEAMEROPTIONS += --pdf-engine=pdflatex +BEAMEROPTIONS += --pdf-engine=xelatex BEAMEROPTIONS += --default-image-extension=pdf BEAMEROPTIONS += -V theme:metropolis BEAMEROPTIONS += -V themeoptions:numbering=none -V themeoptions:progressbar=foot BEAMEROPTIONS += -V fontsize=smaller BEAMEROPTIONS += --highlight-style espresso +BEAMEROPTIONS += -H ./header.tex --listings +BLA = $(shell git log | head -n 1) default: git_tutorial.md + echo $(BLA) + sed -i '3s/.*/% $(BLA)/' git_tutorial.md pandoc -s $(BEAMEROPTIONS) -o git_tutorial.pdf git_tutorial.md deploy: default diff --git a/git_tutorial.md b/git_tutorial.md index eb5b6992f831f183bdf7d62ec0be2351b52da683..dabf4674b49963529349a292884a50dc935a9b9b 100644 --- a/git_tutorial.md +++ b/git_tutorial.md @@ -1,6 +1,6 @@ % Introduction à Git % Orestis Malaspinas -% Version 6a487a9ed53c19b24e7b3dc0cff9a38896ccf666 +% commit 3dcae83e4de3ce77d6b0bc1e2a6d63fb2da6e101 # Des références @@ -12,7 +12,7 @@ Il existe énormément de très bons documents et tutoriels en ligne: Des tas de repo en ligne: - [Githepia](https://githepia.hesge.ch) -- [Githhub](https://www.github.com) +- [Github](https://www.github.com) - [Gitlab](https://www.gitlab.com) 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). * Cela évite d'avoir à gérer les fichiers d'un projet comme: - fichier.c - - fichier_10_3_2018.c - - fichier_10_3_2018_16h.c - - fichier_10_3_2018_16h_Malaspinas.c - - fichier_10_3_2018_16h_Gluck.c + - fichier_10_3_2019.c + - fichier_10_3_2019_16h.c + - fichier_10_3_2019_16h_Malaspinas.c + - fichier_10_3_2019_16h_Antoniadis.c * L'historique est accessible à tout moment. * Difficile d'écraser le mauvais fichier lors d'une synchronisation. - 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 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. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} $ git clone ssh://git@ssh.hesge.ch:10572/orestis.malaspin/tutorial.git Cloning into 'tutorial'... warning: You appear to have cloned an empty repository. @@ -73,7 +73,7 @@ $ cd tutorial 2. Ajout du `premierfichier.c` aux fichiers suivis par git. 3. *Commit* du fichier ajouté à l'historique des modifications. 4. *Push* de l'état de l'historique sur le serveur. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [tutorial]$ echo Hello World > premierfichier.c [tutorial]$ git status On branch master @@ -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` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [tutorial]$ git add premierfichier.c [tutorial]$ git status On branch master @@ -115,7 +115,7 @@ Changes to be committed: ## Commandes: `git add`, `git status`, `git commit`, `git push` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [tutorial]$ git status On branch master 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 1. Modification du fichier `premierfichier.c`. 2. Ajout/commit/push des modifictations. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [tutorial]$ echo Wild World > premierfichier.c [tutorial]$ git status On branch master @@ -171,7 +171,7 @@ no changes added to commit (use "git add" and/or "git commit -a") ## Commandes: `git diff`, `git log` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [tutorial]$ git diff diff --git a/premierfichier.c b/premierfichier.c index 557db03..9622e40 100644 @@ -195,7 +195,7 @@ To ssh://ssh.hesge.ch:10572/orestis.malaspin/tutorial.git ## Commandes: `git diff`, `git log` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [tutorial]$ git log commit f9ab3ec4a00c46a12d7a45f133295acc5fb5cd20 (HEAD -> master, origin/master) Author: Orestis Malaspinas <orestis.malaspinas@hesge.ch> @@ -214,11 +214,11 @@ Date: Sun Mar 4 22:25:24 2018 +0100 ## Commandes: `git checkout`, `git reset` -1. Faire une modification dans un fichier qu'on aurait pas voulu faire. -2. Faire un `git add` qu'on aurait pas dû faire. -3. Faire un `git commit` qu'on aurait pas dû faire. +1. Faire une modification dans un fichier par erreur. +2. Faire un `git add` par erreur. +3. Faire un `git commit` par erreur. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [tutorial]$ echo Oh no! An awful modification! > premierfichier.c [tutorial]$ git status On branch master @@ -237,10 +237,10 @@ no changes added to commit (use "git add" and/or "git commit -a") ## 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} -[tutorial]$ git checkout premierfichier.c +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +[tutorial]$ git checkout premierfichier.c [tutorial]$ git status On branch master Your branch is up to date with 'origin/master'. @@ -253,9 +253,9 @@ nothing to commit, working tree clean ## 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]$ git add premierfichier.c [tutorial]$ git status @@ -275,9 +275,9 @@ M premierfichier.c ## 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 On branch master Your branch is up to date with 'origin/master'. @@ -303,9 +303,9 @@ index 9622e40..cfd5469 100644 ## 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" [master 0563c02] troisieme commit 1 file changed, 1 insertion(+), 1 deletion(-) @@ -327,9 +327,9 @@ no changes added to commit ## 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]$ git commit -am "la bonne troisieme modification" [master 1b42970] la bonne troisieme modification @@ -352,12 +352,12 @@ Automatic merge failed; fix conflicts and then commit the result. # Retirer un fichier du contrôle de version (1/3) ## Commande: `git rm` - + - 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} -[malaspor@perka tutorial]$ git rm premierfichier.c +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +[malaspor@perka tutorial]$ git rm premierfichier.c rm 'premierfichier.c' [malaspor@perka tutorial]$ git status On branch master @@ -375,9 +375,9 @@ Changes to be committed: # 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 total 0 [malaspor@perka tutorial]$ git reset bbb151324289dc2f85468f5721ec1021692dd216 @@ -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) -## Commande: `git rm` +## Commande: `git rm` (2/2) On peut retrouver le fichier dans l'historique. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} [malaspor@perka tutorial]$ ls -ltr total 0 [malaspor@perka tutorial]$ git checkout premierfichier.c @@ -419,6 +419,9 @@ Il existe une **grande quantité** de fonctionnalités non discutées ici: 2. `git branch` 3. `git merge` 4. `git tag` + +**ET SURTOUT:** + 5. `git trois-lignes-de-commandes-incompréhensibles-que-seul stackoverflow-peut-vous-permettre-d'écrire` diff --git a/header.tex b/header.tex new file mode 100644 index 0000000000000000000000000000000000000000..274cdbd95a104ad0c543dff6baf335142525a1dc --- /dev/null +++ b/header.tex @@ -0,0 +1,17 @@ +\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, +}