Commit 7c52c56b authored by Elise Maigne's avatar Elise Maigne
Browse files

update pres

parent 0122a887
......@@ -116,6 +116,8 @@ class: center, middle
git init
```
--
### Sur un serveur distant (gitlab par exemple)
1. Création d'un projet sur une forge
2. Clone de ce projet sur sa machine en local avec `git clone`
......@@ -124,6 +126,8 @@ git init
git clone git@forgemia.inra.fr:elise.maigne/2021_git.git
```
--
<center>
```{r, echo=FALSE, fig.height=1.5}
gitsteps <- DiagrammeR::grViz("
......@@ -131,7 +135,7 @@ gitsteps <- DiagrammeR::grViz("
rankdir = LR;
bgcolor = '#EAEAEA';
edge [minlen = 3]
node [fontsize=40 shape=cylinder style=filled color='#822744' fillcolor='#EAEAEA' fontcolor='#822744' width=2 height=1.5]
node [fontsize=40 shape=cylinder style=filled color='#822744' fillcolor='#c98399' fontcolor='#822744' width=2 height=1.5]
local [label=local penwidth=4]
remote [label=remote penwidth=4]
node [fontcolor='#b0b0b0' color='#b0b0b0' fillcolor = '#ededed']
......@@ -147,7 +151,7 @@ widgetframe::frameableWidget(gitsteps)
---
# Un commit = un changement
#### 1. On indique à git qu'il doit suivre ces fichiers et on les intègre au prochain commit `git add`
#### 1. On indique à git qu'il doit suivre ces fichiers et on intègre les modifications au prochain commit `git add`
.pull-left[
```{bash, eval=FALSE}
git add *
......@@ -182,8 +186,8 @@ gitsteps <- DiagrammeR::grViz("
head [label=HEAD]
node [fontcolor='#b0b0b0' color='#b0b0b0' fillcolor = '#ededed']
remote [label=remote penwidth=4]
local -> stage [label = add fontsize=30]
stage -> head [label=commit fontsize=30]
local -> stage [label = add fontsize=30 penwidth=4]
stage -> head [label=commit fontsize=30 penwidth=4]
head -> remote
{rank = same; local; stage; head; remote;};
}")
......@@ -193,7 +197,7 @@ widgetframe::frameableWidget(gitsteps)
--
En pratique (chez moi) :
En pratique (chez moi - sur RStudio) :
```{bash, eval=FALSE}
git add *
......@@ -222,7 +226,7 @@ gitsteps <- DiagrammeR::grViz("
local [label=local penwidth=4]
stage [label=stage]
local -> stage -> head
head -> remote [label = push fontsize=30]
head -> remote [label = push fontsize=30 penwidth=4]
{rank = same; local; stage; head; remote;};
}")
widgetframe::frameableWidget(gitsteps)
......@@ -248,7 +252,7 @@ gitsteps <- DiagrammeR::grViz("
head [label=HEAD]
stage [label=stage]
local -> stage -> head -> remote
remote -> local [label = pull fontsize=30 constraint=false]
remote -> local [label = pull fontsize=30 constraint=false penwidth=4]
{rank = same; local; stage; head; remote;};
}")
widgetframe::frameableWidget(gitsteps)
......@@ -379,10 +383,10 @@ git branch mabranche
```{bash, eval=FALSE}
git checkout mabranche
git checkout main
git checkout monautrebranche
```
On ne peut changer de branche uniquement si toutes les modifications sont commitées.
On ne peut changer de branche uniquement si toutes les modifications (des fichiers suivis) sont commitées.
---
# Les branches
......@@ -392,7 +396,7 @@ git checkout mabranche
git merge main
```
### Les conflits
#### Les conflits
Si un fichier est modifié 2 fois au même endroit.
```{bash, eval=FALSE}
<<<<<<< HEAD:fichier.R
......@@ -421,6 +425,7 @@ Exemple : j'ai un projet qui crée un fichier html à l'aide de Rmarkdown. --> S
#### CI/CD (integration continue)
Par exemple compiler ses Rmd automatiquement.
Faire des tests automatiques.
--
......@@ -454,6 +459,9 @@ Un projet "principal" forké (`git fork`) par les étudiants qui partent de la m
#### Revenir en arrière
- `git revert`
#### Savoir où on en est
- `git status`
...
]
......
......@@ -4,7 +4,7 @@
<title>L’écosystème Git</title>
<meta charset="utf-8" />
<meta name="author" content="Elise Maigné" />
<meta name="date" content="2021-10-28" />
<meta name="date" content="2021-11-22" />
<script src="libs/header-attrs/header-attrs.js"></script>
<script src="libs/htmlwidgets/htmlwidgets.js"></script>
<script src="libs/viz/viz.js"></script>
......@@ -21,7 +21,7 @@ class: center, middle, inverse, title-slide
# L’écosystème Git
## Git : fonctionnement, outils, possibilités
### Elise Maigné
### 2021-10-28
### 2021-11-22
---
......@@ -115,6 +115,8 @@ class: center, middle
git init
```
--
### Sur un serveur distant (gitlab par exemple)
1. Création d'un projet sur une forge
2. Clone de ce projet sur sa machine en local avec `git clone`
......@@ -124,18 +126,20 @@ git init
git clone git@forgemia.inra.fr:elise.maigne/2021_git.git
```
--
&lt;center&gt;
<div id="htmlwidget-5cc56b7dbafb6355347c" style="width:504px;height:108px;" class="grViz html-widget"></div>
<div id="htmlwidget-e90ffe28e8b51a154c0d" style="width:504px;height:108px;" class="grViz html-widget"></div>
<script>HTMLWidgets.pymChild = new pym.Child();HTMLWidgets.addPostRenderHandler(function(){
setTimeout(function(){HTMLWidgets.pymChild.sendHeight();},100);
});</script>
<script type="application/json" data-for="htmlwidget-5cc56b7dbafb6355347c">{"x":{"diagram":"\n digraph {\n rankdir = LR;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#EAEAEA\" fontcolor=\"#822744\" width=2 height=1.5]\n local [label=local penwidth=4]\n remote [label=remote penwidth=4]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n stage [label=stage]\n head [label=HEAD]\n local -> stage -> head -> remote\n }\n","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<script type="application/json" data-for="htmlwidget-e90ffe28e8b51a154c0d">{"x":{"diagram":"\n digraph {\n rankdir = LR;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#c98399\" fontcolor=\"#822744\" width=2 height=1.5]\n local [label=local penwidth=4]\n remote [label=remote penwidth=4]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n stage [label=stage]\n head [label=HEAD]\n local -> stage -> head -> remote\n }\n","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
&lt;/center&gt;
---
# Un commit = un changement
#### 1. On indique à git qu'il doit suivre ces fichiers et on les intègre au prochain commit `git add`
#### 1. On indique à git qu'il doit suivre ces fichiers et on intègre les modifications au prochain commit `git add`
.pull-left[
```bash
......@@ -161,16 +165,16 @@ git commit -m "Ma belle modification"
--
&lt;center&gt;
<div id="htmlwidget-abc7ef942963400f248a" style="width:504px;height:108px;" class="grViz html-widget"></div>
<div id="htmlwidget-644c432baf33e19b867a" style="width:504px;height:108px;" class="grViz html-widget"></div>
<script>HTMLWidgets.pymChild = new pym.Child();HTMLWidgets.addPostRenderHandler(function(){
setTimeout(function(){HTMLWidgets.pymChild.sendHeight();},100);
});</script>
<script type="application/json" data-for="htmlwidget-abc7ef942963400f248a">{"x":{"diagram":"\n digraph {\n rankdir = TB;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#c98399\" fontcolor=\"#822744\" width=2 height=1.5]\n local [label=local penwidth=4]\n stage [label=stage]\n head [label=HEAD]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n remote [label=remote penwidth=4]\n local -> stage [label = add fontsize=30]\n stage -> head [label=commit fontsize=30]\n head -> remote\n {rank = same; local; stage; head; remote;}; \n }","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<script type="application/json" data-for="htmlwidget-644c432baf33e19b867a">{"x":{"diagram":"\n digraph {\n rankdir = TB;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#c98399\" fontcolor=\"#822744\" width=2 height=1.5]\n local [label=local penwidth=4]\n stage [label=stage]\n head [label=HEAD]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n remote [label=remote penwidth=4]\n local -> stage [label = add fontsize=30 penwidth=4]\n stage -> head [label=commit fontsize=30 penwidth=4]\n head -> remote\n {rank = same; local; stage; head; remote;}; \n }","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
&lt;/center&gt;
--
En pratique (chez moi) :
En pratique (chez moi - sur RStudio) :
```bash
......@@ -188,11 +192,11 @@ git push
```
&lt;center&gt;
<div id="htmlwidget-cdece735de8a114293ba" style="width:504px;height:108px;" class="grViz html-widget"></div>
<div id="htmlwidget-b09f7c264842b595133e" style="width:504px;height:108px;" class="grViz html-widget"></div>
<script>HTMLWidgets.pymChild = new pym.Child();HTMLWidgets.addPostRenderHandler(function(){
setTimeout(function(){HTMLWidgets.pymChild.sendHeight();},100);
});</script>
<script type="application/json" data-for="htmlwidget-cdece735de8a114293ba">{"x":{"diagram":"\n digraph {\n rankdir = TB;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#c98399\" fontcolor=\"#822744\" width=2 height=1.5]\n head [label=HEAD]\n remote [label=remote penwidth=4]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n local [label=local penwidth=4]\n stage [label=stage]\n local -> stage -> head\n head -> remote [label = push fontsize=30]\n {rank = same; local; stage; head; remote;}; \n }","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<script type="application/json" data-for="htmlwidget-b09f7c264842b595133e">{"x":{"diagram":"\n digraph {\n rankdir = TB;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#c98399\" fontcolor=\"#822744\" width=2 height=1.5]\n head [label=HEAD]\n remote [label=remote penwidth=4]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n local [label=local penwidth=4]\n stage [label=stage]\n local -> stage -> head\n head -> remote [label = push fontsize=30 penwidth=4]\n {rank = same; local; stage; head; remote;}; \n }","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
&lt;/center&gt;
#### Récupération de l'état du remote
......@@ -202,11 +206,11 @@ git pull
```
&lt;center&gt;
<div id="htmlwidget-5e94141788e0752f98ef" style="width:504px;height:108px;" class="grViz html-widget"></div>
<div id="htmlwidget-f8325999d4dcb613a7d4" style="width:504px;height:108px;" class="grViz html-widget"></div>
<script>HTMLWidgets.pymChild = new pym.Child();HTMLWidgets.addPostRenderHandler(function(){
setTimeout(function(){HTMLWidgets.pymChild.sendHeight();},100);
});</script>
<script type="application/json" data-for="htmlwidget-5e94141788e0752f98ef">{"x":{"diagram":"\n digraph {\n rankdir = TB;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#c98399\" fontcolor=\"#822744\" width=2 height=1.5]\n local [label=local penwidth=4]\n remote [label=remote penwidth=4]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n head [label=HEAD]\n stage [label=stage]\n local -> stage -> head -> remote\n remote -> local [label = pull fontsize=30 constraint=false]\n {rank = same; local; stage; head; remote;}; \n }","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<script type="application/json" data-for="htmlwidget-f8325999d4dcb613a7d4">{"x":{"diagram":"\n digraph {\n rankdir = TB;\n bgcolor = \"#EAEAEA\";\n edge [minlen = 3]\n node [fontsize=40 shape=cylinder style=filled color=\"#822744\" fillcolor=\"#c98399\" fontcolor=\"#822744\" width=2 height=1.5]\n local [label=local penwidth=4]\n remote [label=remote penwidth=4]\n node [fontcolor=\"#b0b0b0\" color=\"#b0b0b0\" fillcolor = \"#ededed\"]\n head [label=HEAD]\n stage [label=stage]\n local -> stage -> head -> remote\n remote -> local [label = pull fontsize=30 constraint=false penwidth=4]\n {rank = same; local; stage; head; remote;}; \n }","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
&lt;/center&gt;
---
......@@ -282,22 +286,22 @@ Il est possible de créer de nouvelles branches, pour tester une autre direction
.pull-left[
Projet d'application à plusieurs, 1 branche = 1 fonctionalité, plusieurs fonctionalités en même temps.
<div id="htmlwidget-02e01ef025b27a7b349c" style="width:504px;height:288px;" class="grViz html-widget"></div>
<div id="htmlwidget-5f853ca1817e5cd22643" style="width:504px;height:288px;" class="grViz html-widget"></div>
<script>HTMLWidgets.pymChild = new pym.Child();HTMLWidgets.addPostRenderHandler(function(){
setTimeout(function(){HTMLWidgets.pymChild.sendHeight();},100);
});</script>
<script type="application/json" data-for="htmlwidget-02e01ef025b27a7b349c">{"x":{"diagram":"\ndigraph {\n\trankdir=\"LR\";\n\tbgcolor=\"transparent\";\n\tnode[width=0.15, height=0.15, shape=point, color=\"#822744\"];\n\tedge[weight=2, arrowhead=none, color=\"#822744\"];\n\tnode[group=master];\n\t1 -> 2 -> 3 -> 4 -> 5;\n\tnode[group=branch];\n\t2 -> 6 -> 7 -> 4;\n\tnode[group=branch];\n\t2 -> 8 -> 9 -> 10;\n\tnode[group=branch];\n\t2 -> 11 -> 12 -> 13 -> 14 -> 15;\n}","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<script type="application/json" data-for="htmlwidget-5f853ca1817e5cd22643">{"x":{"diagram":"\ndigraph {\n\trankdir=\"LR\";\n\tbgcolor=\"transparent\";\n\tnode[width=0.15, height=0.15, shape=point, color=\"#822744\"];\n\tedge[weight=2, arrowhead=none, color=\"#822744\"];\n\tnode[group=master];\n\t1 -> 2 -> 3 -> 4 -> 5;\n\tnode[group=branch];\n\t2 -> 6 -> 7 -> 4;\n\tnode[group=branch];\n\t2 -> 8 -> 9 -> 10;\n\tnode[group=branch];\n\t2 -> 11 -> 12 -> 13 -> 14 -> 15;\n}","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
]
--
.pull-right[
Développement d'un package R : une branche correspond à une modification majeure du code. La branche main est toujours supposée tourner.
<div id="htmlwidget-54b374d1f85eef52165d" style="width:504px;height:288px;" class="grViz html-widget"></div>
<div id="htmlwidget-f73e94314218f55a901c" style="width:504px;height:288px;" class="grViz html-widget"></div>
<script>HTMLWidgets.pymChild = new pym.Child();HTMLWidgets.addPostRenderHandler(function(){
setTimeout(function(){HTMLWidgets.pymChild.sendHeight();},100);
});</script>
<script type="application/json" data-for="htmlwidget-54b374d1f85eef52165d">{"x":{"diagram":"\ndigraph {\n\trankdir=\"LR\";\n\tbgcolor=\"transparent\";\n\tnode[width=0.15, height=0.15, shape=point, color=\"#822744\"];\n\tedge[weight=2, arrowhead=none, color=\"#822744\"];\n\tnode[group=master];\n\t1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8;\n\tnode[group=branch];\n\t2 -> 9 -> 10 -> 11 -> 3;\n\tnode[group=branch];\n\t5 -> 12 -> 13 -> 14 -> 6;\n}","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
<script type="application/json" data-for="htmlwidget-f73e94314218f55a901c">{"x":{"diagram":"\ndigraph {\n\trankdir=\"LR\";\n\tbgcolor=\"transparent\";\n\tnode[width=0.15, height=0.15, shape=point, color=\"#822744\"];\n\tedge[weight=2, arrowhead=none, color=\"#822744\"];\n\tnode[group=master];\n\t1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8;\n\tnode[group=branch];\n\t2 -> 9 -> 10 -> 11 -> 3;\n\tnode[group=branch];\n\t5 -> 12 -> 13 -> 14 -> 6;\n}","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
]
---
......@@ -315,10 +319,10 @@ git branch mabranche
```bash
git checkout mabranche
git checkout main
git checkout monautrebranche
```
On ne peut changer de branche uniquement si toutes les modifications sont commitées.
On ne peut changer de branche uniquement si toutes les modifications (des fichiers suivis) sont commitées.
---
# Les branches
......@@ -329,7 +333,7 @@ git checkout mabranche
git merge main
```
### Les conflits
#### Les conflits
Si un fichier est modifié 2 fois au même endroit.
```bash
......@@ -359,6 +363,7 @@ Exemple : j'ai un projet qui crée un fichier html à l'aide de Rmarkdown. --&gt
#### CI/CD (integration continue)
Par exemple compiler ses Rmd automatiquement.
Faire des tests automatiques.
--
......@@ -392,6 +397,9 @@ Un projet "principal" forké (`git fork`) par les étudiants qui partent de la m
#### Revenir en arrière
- `git revert`
#### Savoir où on en est
- `git status`
...
]
......
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