Parcourir la source

fork (pas fini)

Julien Dehos il y a 8 ans
Parent
commit
b799e88abf
16 fichiers modifiés avec 627 ajouts et 28 suppressions
  1. 104 25
      branches.md
  2. 33 0
      branches_02.svg
  3. 34 0
      branches_03.svg
  4. 35 0
      branches_04.svg
  5. 40 0
      branches_05.svg
  6. 46 0
      branches_06.svg
  7. 52 0
      branches_07.svg
  8. 50 0
      branches_08.svg
  9. 52 0
      branches_09.svg
  10. 49 0
      branches_10.svg
  11. 46 0
      branches_11.svg
  12. BIN
      branches_13.png
  13. BIN
      branches_13a.png
  14. BIN
      branches_13b.png
  15. 86 3
      forks.md
  16. BIN
      forks_07.png

+ 104 - 25
branches.md

@@ -8,80 +8,159 @@ output:
 
 
 # Branches 
 # Branches 
 
 
-Lorsque l'on travaille sur un dépôt, on réalise des commits successifs. Git
-permet également, à partir d'un commit donné, de réaliser plusieurs branches de
-commits en parallèle.  Ceci permet de faire une série de modifications sans
-risquer de perturber la branche principale du projet, utilisée par tout le
-monde.  Une branche peut ensuite être fusionnée dans une autre, par exemple
-dans la branche principale, pour y intégrer ses modifications une fois
-abouties.  Si les modifications n'ont pas abouties, la branche peut être
-abandonnée ou même supprimée.
+Lorsque l'on crée successivement des commits, ceux-ci sont ajoutés les uns à la
+suite des autres, sur une même branche.  Git permet également, à partir d'un
+commit donné, de réaliser plusieurs branches en parallèle.  Les branches
+peuvent ensuite être fusionnées, abandonnées ou même supprimées.
 
 
 L'utilisation des branches est très naturelle avec git et permet d'organiser le
 L'utilisation des branches est très naturelle avec git et permet d'organiser le
-déroulement du projet. Souvent, on utilise une branche master qui "doit
-toujours fonctionner"; pour chaque fonctionnalité à ajouter, on dérive une
-nouvelle branche que l'on fusionne ensuite dans le master une fois la
+déroulement du projet. Souvent, on utilise une branche principale "master" qui
+"doit toujours fonctionner" et, pour chaque fonctionnalité à ajouter, on dérive
+une nouvelle branche que l'on fusionne ensuite dans le master une fois la
 fonctionnalité réalisée (ou partiellement réalisée) et testée.
 fonctionnalité réalisée (ou partiellement réalisée) et testée.
 
 
 ![](branches_01.svg)
 ![](branches_01.svg)
 
 
 ## Afficher les branches 
 ## Afficher les branches 
+
+La commande `git branch` permet d'afficher les branches.
+
 ![](branches_01.png)
 ![](branches_01.png)
 
 
-git log --graph --all --oneline --decorate
+On peut avoir plus d'information avec la commande `git log --graph --all --oneline --decorate`.
+
+![](branches_21.png)
+
+![](branches_02.svg)
 
 
 ## Créer une nouvelle branche locale
 ## Créer une nouvelle branche locale
+
+La command `git branch ...` permet de créer de nouvelles branches.
+
 ![](branches_02.png)
 ![](branches_02.png)
 
 
+![](branches_03.svg)
+
 ## Changer de branche
 ## Changer de branche
+
+La commande `git checkout ...` permet de sélectionner une branche.
+
 ![](branches_03.png)
 ![](branches_03.png)
 
 
+![](branches_04.svg)
+
+Les nouveaux commits sont alors effectués pour la branche sélectionnée.
+
 ![](branches_05.png)
 ![](branches_05.png)
 
 
-## Fusionner des branches
+![](branches_05.svg)
+
+Le master est une branche comme les autres qu'on peut également sélectionnée.
 
 
 ![](branches_06.png)
 ![](branches_06.png)
+
+![](branches_06.svg)
+
+## Fusionner des branches
+
+Pour fusionner des branches, il faut d'abord sélectionner la branche qui doit
+recevoir les modifications puis utiliser la commande `git merge`.
+
 ![](branches_08.png)
 ![](branches_08.png)
+
+![](branches_07.svg)
+
+Un nouveau commit, correspondant à la fusion est alors créé. On peut le 
+vérifier avec un `git log`...
+
 ![](branches_09.png)
 ![](branches_09.png)
+
+... ou avec un client graphique.
+
 ![](branches_10.png)
 ![](branches_10.png)
 
 
 ## Envoyer une branche sur un dépôt distant
 ## Envoyer une branche sur un dépôt distant
+
+Lorsque l'on crée une branche, celle-ci est locale au dépôt. Pour la créer et 
+l'envoyer également sur le serveur, il faut utiliser la commande `git push
+--set-upstream ...`. Ainsi, la branche locale et la branche distante seront
+associées et il suffira ensuite d'un push classique de la branche locale pour
+l'envoyer sur le serveur.
+
 ![](branches_11.png)
 ![](branches_11.png)
+
+![](branches_08.svg)
+
+On peut également voir sur le site gogs que la branche a bien été créée sur le 
+serveur.
+
 ![](branches_12.png)
 ![](branches_12.png)
 
 
 ## Afficher les branches distantes
 ## Afficher les branches distantes
+
+La commande `git ls-remote` permet de lister les branches distantes.
+
 ![](branches_15.png)
 ![](branches_15.png)
 
 
 ## Terminer une branche locale
 ## Terminer une branche locale
-![](branches_13.png)
+
+Pour terminer une branche locale (c'est-à-dire supprimer l'étiquette
+correspondante), il faut d'abord sélectionner une autre branche...
+
+![](branches_13a.png)
+
+![](branches_09.svg)
+
+... puis utiliser la commande `git branch -d ...`.
+
+![](branches_13b.png)
+
+![](branches_10.svg)
 
 
 ## Terminer une branche distante
 ## Terminer une branche distante
+
+Pour terminer une branche distante (c'est-à-dire supprimer l'étiquette
+correspondante), il faut utiliser la commande `git push --delete ...`
+
 ![](branches_16.png)
 ![](branches_16.png)
 
 
-## Supprimer un commit déjà pushé (DANGER !!!)
-git reset --hard e6c8e8e
-git push origin HEAD:master -f
-git reset --hard e6c8e8e
+![](branches_11.svg)
 
 
-![](branches_18.png)
+## Supprimer un commit déjà pushé (DANGER !!!)
 
 
+Généralement, vouloir supprimer un commit déjà envoyé sur le serveur est une
+mauvaise idée.  En effet, en plus de perdre les données sauvegardées, cela peut
+casser les commits d'un collègue qui aurait déjà récupéré et continué les
+commits en question, donc il vaut mieux committer des corrections.
 
 
-TODO : supprimer
+Mais si c'est vraiment ce que vous voulez faire, voici la procédure (pensez
+à vérifier que les commits locaux sont également supprimés sinon les commits
+supprimés sur le serveur seront de nouveau envoyés au prochain push).
 
 
-![](branches_17.png)
-![](branches_21.png)
+![](branches_18.png)
 
 
 ## Résumé et méthode de travail
 ## Résumé et méthode de travail
 
 
 Résumé des commandes git précédentes :
 Résumé des commandes git précédentes :
 
 
 ---|---|
 ---|---|
-`git ` | |
+`git branch` | TODO |
+`git log --graph --all --oneline --decorate` | |
+`git ls-remote` | |
+`git branch ...` | |
+`git checkout ...` | |
+`git merge ...` | |
+`git push --set-upstream ...` | |
+`git branch -d ...` | |
+`git push --delete ...` | |
 
 
 Quelques conseils de méthode de travail :
 Quelques conseils de méthode de travail :
 
 
-- TODO
-
+- utilisez une branche master "qui marche"
+- pour chaque tâche du projet, créez une branche dédiée, que vous fusionnerez
+  dans le master une fois la tâche réalisée.
+- utiliser des branches ne vaccine pas contre les conflits, donc pensez à faire
+  quand même le point avec vos collègues régulièrement.
 
 
 ## Exercice
 ## Exercice
 
 

+ 33 - 0
branches_02.svg

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="300" >
+
+<g transform="translate(-100,80)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="230" y="55" font-size="18"> e6c... </text>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="210" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="225" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,-30 L250,10' />
+
+<rect x="210" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="220" y="145" font-size="18"> *master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+<rect x="180" y="160" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="185" font-size="18"> origin/master </text>
+
+</g>
+
+</svg>
+
+

+ 34 - 0
branches_03.svg

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="330" >
+
+<g transform="translate(-100,120)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="210" y="-110" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="225" y="-85" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,-30 L250,10' />
+
+<rect x="180" y="-70" width="140" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="190" y="-45" font-size="18"> intro_papier </text>
+
+<rect x="210" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="220" y="145" font-size="18"> *master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+<rect x="180" y="160" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="185" font-size="18"> origin/master </text>
+
+</g>
+
+</svg>
+

+ 35 - 0
branches_04.svg

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="330" >
+
+<g transform="translate(-100,120)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="210" y="-110" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="225" y="-85" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,-30 L250,10' />
+
+<rect x="180" y="-70" width="140" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="190" y="-45" font-size="18"> *intro_papier </text>
+
+<rect x="210" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="220" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+<rect x="180" y="160" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="185" font-size="18"> origin/master </text>
+
+</g>
+
+</svg>
+
+

+ 40 - 0
branches_05.svg

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="430" >
+
+<g transform="translate(-100,220)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M250,20 C250,-50 310,-50 310,-50 ' />
+<circle cx="350" cy="-50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="310" y="-210" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="325" y="-185" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,-130 L350,-90' />
+
+<rect x="280" y="-170" width="140" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="290" y="-145" font-size="18"> *intro_papier </text>
+
+<rect x="210" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="220" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+<rect x="180" y="160" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="185" font-size="18"> origin/master </text>
+
+</g>
+
+</svg>
+
+
+

+ 46 - 0
branches_06.svg

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="380" >
+
+<g transform="translate(-100,200)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M250,20 C250,-50 310,-50 310,-50 ' />
+<circle cx="350" cy="-50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M280,50 L410,50' />
+<circle cx="450" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="410" y="-60" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="425" y="-35" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M450,-20 L450,10' />
+
+<rect x="280" y="-170" width="140" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="290" y="-145" font-size="18"> intro_papier </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,-130 L350,-90' />
+
+<rect x="410" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="420" y="145" font-size="18"> *master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M450,120 L450,90' />
+
+<rect x="180" y="120" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="145" font-size="18"> origin/master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+</g>
+
+</svg>
+
+
+
+

+ 52 - 0
branches_07.svg

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="380" >
+
+<g transform="translate(-100,200)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M250,20 C250,-50 310,-50 310,-50 ' />
+<circle cx="350" cy="-50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M280,50 L410,50' />
+<circle cx="450" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M380,-50 C480,-50 520,20 520,20 ' />
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M480,50 L510,50' />
+<circle cx="550" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="510" y="-60" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="525" y="-35" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,-20 L550,10' />
+
+<rect x="280" y="-170" width="140" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="290" y="-145" font-size="18"> intro_papier </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,-130 L350,-90' />
+
+<rect x="510" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="520" y="145" font-size="18"> *master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,120 L550,90' />
+
+<rect x="180" y="120" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="145" font-size="18"> origin/master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+</g>
+
+</svg>
+
+
+
+
+

+ 50 - 0
branches_08.svg

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="440" >
+
+<g transform="translate(-100,270)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M250,20 C250,-50 310,-50 310,-50 ' />
+<circle cx="350" cy="-50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M280,50 L410,50' />
+<circle cx="450" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M380,-50 C480,-50 520,20 520,20 ' />
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M480,50 L510,50' />
+<circle cx="550" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="310" y="-250" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="325" y="-225" font-size="18"> HEAD </text>
+
+<rect x="280" y="-170" width="140" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="290" y="-145" font-size="18"> *intro_papier </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,-130 L350,-90' />
+
+<rect x="510" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="520" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,120 L550,90' />
+
+<rect x="180" y="120" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="145" font-size="18"> origin/master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+<rect x="250" y="-210" width="200" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="260" y="-185" font-size="18"> origin/intro_papier </text>
+
+</g>
+
+</svg>
+

+ 52 - 0
branches_09.svg

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="400" >
+
+<g transform="translate(-100,220)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M250,20 C250,-50 310,-50 310,-50 ' />
+<circle cx="350" cy="-50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M280,50 L410,50' />
+<circle cx="450" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M380,-50 C480,-50 520,20 520,20 ' />
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M480,50 L510,50' />
+<circle cx="550" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="510" y="-60" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="525" y="-35" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,-20 L550,10' />
+
+<rect x="280" y="-170" width="140" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="290" y="-145" font-size="18"> intro_papier </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,-130 L350,-90' />
+
+<rect x="510" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="520" y="145" font-size="18"> *master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,120 L550,90' />
+
+<rect x="180" y="120" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="145" font-size="18"> origin/master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+<rect x="250" y="-210" width="200" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="260" y="-185" font-size="18"> origin/intro_papier </text>
+
+</g>
+
+</svg>
+
+

+ 49 - 0
branches_10.svg

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="350" >
+
+<g transform="translate(-100,180)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M250,20 C250,-50 310,-50 310,-50 ' />
+<circle cx="350" cy="-50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M280,50 L410,50' />
+<circle cx="450" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M380,-50 C480,-50 520,20 520,20 ' />
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M480,50 L510,50' />
+<circle cx="550" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="510" y="-60" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="525" y="-35" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,-20 L550,10' />
+
+<rect x="510" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="520" y="145" font-size="18"> *master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,120 L550,90' />
+
+<rect x="180" y="120" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="145" font-size="18"> origin/master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+<rect x="250" y="-170" width="200" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="260" y="-145" font-size="18"> origin/intro_papier </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,-130 L350,-90' />
+
+</g>
+
+</svg>
+
+

+ 46 - 0
branches_11.svg

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="800" height="270" >
+
+<g transform="translate(-100,100)">
+
+<text x="130" y="55" font-size="18"> ... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M180,50 L210,50' />
+<circle cx="250" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M250,20 C250,-50 310,-50 310,-50 ' />
+<circle cx="350" cy="-50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M280,50 L410,50' />
+<circle cx="450" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<path marker-end='url(#head)' stroke-width='2' fill='none' stroke='black' 
+    d=' M380,-50 C480,-50 520,20 520,20 ' />
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M480,50 L510,50' />
+<circle cx="550" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+
+<defs>
+<marker id='head' orient="auto" markerWidth='4' markerHeight='8' refX='0.2' refY='3'>
+<path d='M0,0 V6 L3,3 Z' />
+</marker>
+</defs>
+
+<rect x="510" y="-60" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="525" y="-35" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,-20 L550,10' />
+
+<rect x="510" y="120" width="90" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="520" y="145" font-size="18"> *master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M550,120 L550,90' />
+
+<rect x="180" y="120" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="190" y="145" font-size="18"> origin/master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M250,120 L250,90' />
+
+</g>
+
+</svg>
+
+
+

BIN
branches_13.png


BIN
branches_13a.png


BIN
branches_13b.png


+ 86 - 3
forks.md

@@ -6,30 +6,113 @@ output:
 
 
 * * * * *
 * * * * *
 
 
-# Forks (collaborer avec d'autres projets)
+# Forks 
 
 
-TODO
+Imaginons que Julien propose un dépôt public, visible par tout le monde, mais
+non modifiable (pour éviter que n'importe qui y fasse n'importe quoi).  Si
+Fabien (à qui il arrive parfois de faire n'importe quoi) veut proposer une
+modification, il peut alors copier le dépôt de Julien (fork), faire ses
+modifications dans son dépôt, puis les soumettre à Julien (pull request), qui
+choisira ou non de les intégrer dans le dépôt initial (upstream).
+
+Le fork est un mode de fonctionnement très répandu dans le monde de
+l'open-source (github entre autres).
+Le serveur gogs du SCOSI possède également une partie publique mais visible
+après connexion (donc réservée aux étudiants et personnels de l'université).
+
+Attention : pour les intervenants réguliers et de confiance, il est plus simple
+de les autoriser à modifier directement le dépôt principal, en les ajoutant
+comme collaborateurs (les deux systèmes sont complémentaires). 
 
 
 ## Forker un dépôt distant
 ## Forker un dépôt distant
 
 
-## Envoyer un pull request
+Le dépôt de Julien est déjà sur le serveur, dans la partie publique. Fabien se
+connecte sur le site gogs du SCOSI.  
 
 
 ![](forks_01.png)
 ![](forks_01.png)
+
+Il explore la zone publique et sélectionne le dépôt de Julien.
+
 ![](forks_02.png)
 ![](forks_02.png)
+
+Il demande de forker le projet.
+
 ![](forks_03.png)
 ![](forks_03.png)
+
+Ce qui lui crée un nouveau dépôt...
+
 ![](forks_04.png)
 ![](forks_04.png)
+
+... qui est une copie du dépôt initial.
+
 ![](forks_05.png)
 ![](forks_05.png)
+
+Fabien peut ensuite cloner son nouveau dépôt...
+
 ![](forks_06a.png)
 ![](forks_06a.png)
+
+... y faire ses modifications, **de préférence dans une nouvelle branche**, ...
+
 ![](forks_06b.png)
 ![](forks_06b.png)
+
+... et les pusher sur son dépôt distant.
+
 ![](forks_06c.png)
 ![](forks_06c.png)
+
+## Envoyer un pull request
+
+Un pull request est une demande d'intégrer une modification d'un dépôt forké
+dans le dépôt initial (upstream).
+
+Jusqu'ici, Fabien a forké le dépôt de Julien et fait des modifications sur son
+dépôt forké. Pour soumettre ses modifications, il va sur la page correspondant
+à son dépôt et clique sur le bouton pull request.
+
 ![](forks_07.png)
 ![](forks_07.png)
+
+Il met un message pour Julien, expliquant ses modifications (ou pas).
+
 ![](forks_08.png)
 ![](forks_08.png)
+
+Puis le pull request est envoyé à Julien.
+
 ![](forks_09.png)
 ![](forks_09.png)
+
+## Gérer un pull request
+
+De son côté, Julien reçoit le pull request de Fabien, pour le dépôt initial.
+
 ![](forks_j10.png)
 ![](forks_j10.png)
+
+Il peut alors regarder les modifications proposées, échanger des messages avec
+Fabien puis finalement accepter (ou refuser) les modifications.
+
 ![](forks_j11.png)
 ![](forks_j11.png)
+
+Si le pull request est accepté, la modification est fusionné dans le dépôt.
+
 ![](forks_j12.png)
 ![](forks_j12.png)
+
+Elle apparait alors dans la liste des commits. 
+
 ![](forks_j13.png)
 ![](forks_j13.png)
 
 
+Si les modifications du fork ont été faites dans une nouvelle branche, il ne
+faut pas oublier de fusionner dans la branche master sur le dépôt upstream. 
+
+## Mettre à jour un dépôt forké
+
+Après un fork, les deux dépôts (fork et upstream) peuvent évoluer indépendamment.
+
+```
+git remote add upstream https://gogs.univ-littoral.fr/jdehos/tutoriel_git
+git fetch upstream
+git merge upstream/master
+```
+
+## Gérer manuellement un pull request
+
+
 ## Résumé et méthode de travail
 ## Résumé et méthode de travail
 
 
 Résumé des commandes git précédentes :
 Résumé des commandes git précédentes :

BIN
forks_07.png