Parcourir la source

maj depot distant

Julien Dehos il y a 8 ans
Parent
commit
2194a74762

+ 40 - 14
depot_distant.md

@@ -9,9 +9,14 @@ output:
 # Dépôt distant (sauvegarder un projet sur un serveur)
 
 Git permet de synchroniser un dépôt local avec un dépôt distant (sur un
-serveur).  Il existe des serveurs comme github qui permettent d'héberger
-gratuitement des dépôts publics (visibles par tout le monde).
+serveur).  Ceci permet d'envoyer les commits locaux sur le serveur et de
+récupérer les commits du serveur dans le dépôt local. 
+Lorsqu'un dépôt local est synchronisé avec un serveur, une étiquette
+supplémentaire (`origin/master`) est utilisée pour indiquer le dernier commit
+du serveur.
 
+Il existe des serveurs comme github qui permettent d'héberger
+gratuitement des dépôts publics (visibles par tout le monde).
 Le serveur gogs du SCOSI vous permet d'héberger des dépôts publics ou privés.
 Il dispose d'une page web vous permettant de gérer vos projets. Pour cela,
 allez à l'adresse
@@ -20,8 +25,8 @@ identifiants du portail ULCO :
 
 ![](depot_distant_01.png)
 
-Une fois identifié, le site vous affiche une page d'accueil (derniers commits,
-dépôts actifs...) :
+Une fois identifié(e), le site vous affiche une page d'accueil (derniers
+commits, dépôts actifs...) :
 
 ![](depot_distant_02.png)
 
@@ -43,34 +48,55 @@ section suivante).
 
 ![](depot_distant_05.png)
 
-## Créer un dépôt local à partir d'un dépôt distant
+## Cloner un dépôt distant vers un nouveau dépôt local
 
 La commande `git clone ...` permet de récupérer un dépôt distant sur votre
-machine (cf image ci-dessous). Pensez à mettre votre login après le "https://".
+machine (cf image ci-dessous). Pensez à mettre votre login après le "https://"
+(pour vous éviter d'avoir à le retaper sans arrêt, plus tard).
 
 ![](depot_distant_06.png)
 
-## Ajouter un dépôt local à un dépôt distant
+## Synchroniser un dépôt local existant vers un dépôt distant
+
+Si vous avez déjà créé et modifié un dépôt local, 
 
-Si vous avez déjà créé et modifié un dépôt local, vous pouvez le synchroniser
+![](depot_distant_07a.png)
+
+![](depot_distant_07a.svg)
+
+alors vous pouvez le synchroniser
 avec un dépôt distant en utilisant les commandes `git remote add origin ...`
-puis `git push -u origin master`. Sinon, utilisez plutôt la méthode de la
-section précédente.
+puis `git push -u origin master`. 
+
+![](depot_distant_07b.png)
 
-![](depot_distant_07.png)
+![](depot_distant_07b.svg)
 
-## Récupérer les commits d'un dépôt distant
+Si vous avez le choix, faites plutôt un clone (méthode de la section
+précédente) : c'est plus simple et le résultat sera exactement le même.
+
+## Récupérer (tirer) les commits d'un dépôt distant
 
 La commande `git pull` permet de récupérer les éventuelles modifications sur le
 serveur et de les intégrer dans votre dépôt local.
 
 ![](depot_distant_08.png)
 
+![](depot_distant_08.svg)
+
 ## Envoyer les commits locaux sur un dépôt distant
 
-La commande `git push` permet d'envoyer vos commits locaux sur le serveur.
+Après des commits locaux,
+
+![](depot_distant_09a.png)
+
+![](depot_distant_09a.svg)
+
+la commande `git push` permet d'envoyer vos commits locaux sur le serveur.
+
+![](depot_distant_09b.png)
 
-![](depot_distant_09.png)
+![](depot_distant_09b.svg)
 
 Les commits/fichiers envoyés sur le serveur sont alors visibles sur la page web.
 

BIN
depot_distant_01.png


BIN
depot_distant_07.png


BIN
depot_distant_07a.png


+ 26 - 0
depot_distant_07a.svg

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="270" >
+
+<g transform="translate(50,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8c7... </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="10" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="25" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,-30 L50,10' />
+
+<rect x="10" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="20" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,120 L50,90' />
+
+</g>
+
+</svg>
+

BIN
depot_distant_07b.png


+ 29 - 0
depot_distant_07b.svg

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="300" >
+
+<g transform="translate(50,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8c7... </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="10" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="25" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,-30 L50,10' />
+
+<rect x="10" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="20" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,120 L50,90' />
+
+<rect x="-20" y="160" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="-10" y="185" font-size="18"> origin/master </text>
+
+</g>
+
+</svg>
+

+ 34 - 0
depot_distant_08.svg

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="300" >
+
+<g transform="translate(50,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8c7... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M80,50 L110,50' />
+<circle cx="150" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="130" y="55" font-size="18"> feb... </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="110" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="125" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M150,-30 L150,10' />
+
+<rect x="110" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="120" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M150,120 L150,90' />
+
+<rect x="80" y="160" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="90" y="185" font-size="18"> origin/master </text>
+
+</g>
+
+</svg>
+
+

BIN
depot_distant_09.png


BIN
depot_distant_09a.png


+ 35 - 0
depot_distant_09a.svg

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="300" >
+
+<g transform="translate(50,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8c7... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M80,50 L110,50' />
+<circle cx="150" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="130" y="55" font-size="18"> feb... </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="110" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="125" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M150,-30 L150,10' />
+
+<rect x="110" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="120" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M150,120 L150,90' />
+
+<rect x="80" y="160" width="150" height="40" fill="lightblue" stroke-width="2" stroke="black" />
+<text x="90" y="185" font-size="18"> origin/master </text>
+
+</g>
+
+</svg>
+
+
+

BIN
depot_distant_09b.png


+ 0 - 0
depot_distant_09b.svg


+ 20 - 8
depot_local.md

@@ -11,6 +11,11 @@ output:
 L'élément de base d'un projet git est le dépôt. Il s'agit simplement d'un
 dossier classique que l'on demande à git de versionner.
 
+Un dépôt git contient l'ensemble des commits (versions sauvegardées du projet).
+Ces commits peuvent être marqués par des étiquettes. Il existe deux étiquettes
+prédéfinies et gérées par git : `master` (dernier commit) et `HEAD` (commit
+courant, correspondant à l'état courant des fichiers).
+
 ## Initialiser un dépôt
 
 Allez dans le dossier à versionner puis lancez la commande `git init`. 
@@ -59,6 +64,8 @@ commits (journalisation), ce qu'on peut vérifier avec un `git status`.
 
 ![](depot_local_07.png)
 
+![](depot_local_07.svg)
+
 ## Valider les modifications (commit)
 
 Après avoir ajouté, modifié ou supprimé des fichiers, on peut valider les
@@ -88,6 +95,11 @@ Vous pouvez le vérifier avec un `git status`.
 
 ![](depot_local_11.png)
 
+![](depot_local_11.svg)
+
+Ainsi, un `git commit` crée un commit à partir de l'état pointé par HEAD
+et fait pointer master (et HEAD) sur ce nouveau commit.
+
 ## Fichiers autogénérés et .gitignore
 
 Git est très pratique pour gérer des fichiers textes que l'on modifie
@@ -116,12 +128,16 @@ Ainsi, il n'apparaissent plus lors des `git status`.
 
 ![](depot_local_15.png)
 
+![](depot_local_15.svg)
+
 Il est de pratique courante d'ajouter le `.gitignore` au dépôt, ainsi qu'un
 fichier `README.md` qui servira de page d'accueil (au format
 [markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)).
 
 ![](depot_local_16.png)
 
+![](depot_local_16.svg)
+
 
 ## Renommer et supprimer des fichiers
 
@@ -132,10 +148,14 @@ recréer).
 
 ![](depot_local_17.png)
 
+![](depot_local_17.svg)
+
 De même, la commande `git rm` permet de supprimer un fichier versionné.
 
 ![](depot_local_18.png)
 
+![](depot_local_18.svg)
+
 
 ## Afficher l'historique des commits
 
@@ -153,16 +173,8 @@ On peut également le voir avec un client graphique graphique comme `gitg`.
 
 Le "unstaged" correspond aux modifications courantes non commitées.
 
-Pour représenter l'historique d'un dépôt, on utilise souvent un graphe où les
-noeuds représentent les commits. On ajoute également l'étiquette "master", qui
-indique le dernier commit principal, et l'étiquette "HEAD", qui indique l'état
-courant du dépôt.
-
 ![](depot_local_log.svg)
 
-Ainsi, un `git commit` créé un commit à partir de l'état pointé par HEAD
-et fait pointer master (et HEAD) sur ce nouveau commit.
-
 ## Supprimer les modifications courantes
 
 La commande `git checkout -- . ` supprime les modifications courantes. Le dépôt revient

+ 21 - 0
depot_local_07.svg

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="180" >
+
+<g transform="translate(0,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="white"/>
+
+<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="10" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="25" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,-30 L50,10' />
+
+</g>
+
+</svg>
+

+ 26 - 0
depot_local_11.svg

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="200" height="250" >
+
+<g transform="translate(0,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8f6... </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="10" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="25" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,-30 L50,10' />
+
+<rect x="10" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="20" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,120 L50,90' />
+
+</g>
+
+</svg>
+

+ 30 - 0
depot_local_15.svg

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="250" >
+
+<g transform="translate(0,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8f6... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M80,50 L110,50' />
+
+<circle cx="150" cy="50" r="30" stroke="black" stroke-width="2" fill="white"/>
+
+<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="110" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="125" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M150,-30 L150,10' />
+
+<rect x="10" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="20" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M50,120 L50,90' />
+
+</g>
+
+</svg>
+

+ 30 - 0
depot_local_16.svg

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="250" >
+
+<g transform="translate(0,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8f6... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M80,50 L110,50' />
+
+<circle cx="150" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="130" y="55" font-size="18"> 135... </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="110" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="125" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M150,-30 L150,10' />
+
+<rect x="110" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="120" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M150,120 L150,90' />
+
+</g>
+
+</svg>

+ 34 - 0
depot_local_17.svg

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="250" >
+
+<g transform="translate(0,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8f6... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M80,50 L110,50' />
+<circle cx="150" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="130" y="55" font-size="18"> 135... </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"> ed1... </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="80" 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' />
+
+</g>
+
+</svg>
+

+ 39 - 0
depot_local_18.svg

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="400" height="250" >
+
+<g transform="translate(0,80)">
+
+<circle cx="50" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="30" y="55" font-size="18"> 8f6... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M80,50 L110,50' />
+<circle cx="150" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="130" y="55" font-size="18"> 135... </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"> ed1... </text>
+
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M280,50 L310,50' />
+<circle cx="350" cy="50" r="30" stroke="black" stroke-width="2" fill="lightgreen"/>
+<text x="330" y="55" font-size="18"> 7f5... </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="310" y="-70" width="80" height="40" fill="khaki" stroke-width="2" stroke="black" />
+<text x="325" y="-45" font-size="18"> HEAD </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,-30 L350,10' />
+
+<rect x="310" y="120" width="80" height="40" fill="orange" stroke-width="2" stroke="black" />
+<text x="320" y="145" font-size="18"> master </text>
+<path marker-end='url(#head)' stroke-width='2' stroke='black' d='M350,120 L350,90' />
+
+</g>
+
+</svg>
+
+