Resources attached to the Road To DevOps tutorial https://blog.noobtoroot.xyz/road-to-devops/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

223 lines
13 KiB

<!-- .slide: data-background="#2E2E2E" data-state="nologo-slide" -->
# Les principes de GIT
@@
## Sécurisant
* Les opérations sont locales
* Toutes les modifications sont tracées
* Système de checksum
* 1 hash est généré pour chaque opération(sha-1)
* Principalemeent des ajout, peu de suppression
* Perte d'information difficile
* Retour arrière très souvent possible
* Snapshot et pas une recopie complète
@@
<div class="sl-block" data-block-type="text" style="height: auto; min-width: 30px; min-height: 30px; width: 960px; left: 0px; top: 0px;" data-block-id="8c4e9dee4741e976d0b618bcb02e33c2">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 11;">
<h2>Structure d'un dépôt</h2>
</div>
</div>
<div class="sl-block" data-block-type="image" style="min-width: 4px; min-height: 4px; width: 313px; height: 436px; left: 45px; top: 148px;" data-block-id="77440d94fb1a799fd47512a77f2799cd">
<div class="sl-block-content" style="z-index: 12; border-style: solid; border-width: 1px;">
<img data-natural-width="313" data-natural-height="436" style="" data-lazy-loaded="" src="images/04-principe/folder.png"/>
</div>
</div>
<div class="sl-block" data-block-type="text" style="height: auto; min-width: 30px; min-height: 30px; width: 550px; left: 436px; top: 257px;" data-block-id="8acc4c03aff0e2bf536a385c6f3f6edf">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 13;">
<p style="text-align:left">Un dépôt Git est créé en local par :</p>
<p style="text-align:left"><pre><code>$ git init
$ git clone (voir plus loin)</code></pre></p>
</div>
</div>
@@
<div class="sl-block" data-block-type="text" style="height: auto; width: 960px; left: 0px; top: 0px;" data-block-id="fe3b1d8fa757ea307617c038e0a7fe52">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 11;">
<h2>Structure d'un dépôt</h2>
</div>
</div>
<div class="sl-block" data-block-type="image" style="width: 313px; height: 436px; left: 45px; top: 148px; min-width: 4px; min-height: 4px;" data-block-id="e707d8bdef39e2aff0cb1bbf610ae3c7">
<div class="sl-block-content" style="z-index: 12; border-style: solid; border-width: 1px;">
<img data-natural-width="313" data-natural-height="436" style="" data-lazy-loaded="" src="images/04-principe/folder.png"/>
</div>
</div>
<div class="sl-block" data-block-type="text" style="height: auto; width: 550px; left: 436px; top: 257px;" data-block-id="d517414819f705e7085854f6f7325192">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 13;">
<p style="text-align:left">Le dossier <code>.git</code> correspond au dépôt git.</p>
<p style="text-align:left">&nbsp;</p>
<p style="text-align:left">Il contient une version complète du dépôt (historique, configuration...)</p>
</div>
</div>
<div class="sl-block" data-block-type="shape" style="min-width: 4px; min-height: 4px; width: 346px; height: 214px; left: 28px; top: 186px;" data-block-id="97fed2958e47ed19ab6cefaa93874bb2">
<div class="sl-block-style" style="z-index: 14; opacity: 0.43;">
<div class="sl-block-content" data-shape-type="rect" data-shape-fill-color="rgb(109, 158, 235)" data-shape-stretch="true" style="z-index: 14;" data-shape-stroke-color="#000000" data-shape-stroke-width="5px">
<svg
xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 346 214">
<defs>
<clipPath id="shape-mask-1-1554466191461">
<rect width="346" height="214" rx="0" ry="0"></rect>
</clipPath>
</defs>
<rect width="346" height="214" rx="0" ry="0" clip-path="url(#shape-mask-1-1554466191461)" class="shape-element" fill="rgb(109, 158, 235)" stroke="#000000" stroke-width="10"></rect>
</svg>
</div>
</div>
</div>
@@
<div class="sl-block" data-block-type="text" style="height: auto; width: 960px; left: 0px; top: 0px;" data-block-id="1e7abfd99cc4b174104d57ba65a9f26c">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 10;">
<h2>Structure d'un dépôt</h2>
</div>
</div>
<div class="sl-block" data-block-type="image" style="width: 313px; height: 436px; left: 45px; top: 148px; min-width: 4px; min-height: 4px;" data-block-id="97b24b80e0db25649af4a96757b2ba9e">
<div class="sl-block-content" style="z-index: 11; border-style: solid; border-width: 1px;">
<img data-natural-width="313" data-natural-height="436" style="" data-lazy-loaded="" src="images/04-principe/folder.png"/>
</div>
</div>
<div class="sl-block" data-block-type="text" style="height: auto; width: 550px; left: 440px; top: 267px;" data-block-id="8c71b9f980ccb59acf04291ab188b8b8">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 12;" dir="ui">
<p style="text-align:left">Le dossier <code>.git</code> correspond au dépôt git.</p>
<p style="text-align:left">&nbsp;</p>
<p style="text-align:left">&nbsp;</p>
<p style="text-align:left">Les dossiers et fichiers à coté du répertoire <code>.git</code> constituent le
<strong>working directory</strong>.
</p>
</div>
</div>
<div class="sl-block" data-block-type="shape" style="width: 346px; height: 214px; left: 28px; top: 186px;" data-block-id="57cc1ad57a3dc79fdd50d99544a7fcde">
<div class="sl-block-style" style="z-index: 13; opacity: 0.43;">
<div class="sl-block-content" data-shape-type="rect" data-shape-fill-color="rgb(109, 158, 235)" data-shape-stretch="true" style="z-index: 13;" data-shape-stroke-color="#000000" data-shape-stroke-width="5px">
<svg
xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 346 214">
<defs>
<clipPath id="shape-mask-2-1554466479768">
<rect width="346" height="214" rx="0" ry="0"></rect>
</clipPath>
</defs>
<rect width="346" height="214" rx="0" ry="0" clip-path="url(#shape-mask-2-1554466479768)" class="shape-element" fill="rgb(109, 158, 235)" stroke="#000000" stroke-width="10"></rect>
</svg>
</div>
</div>
</div>
<div class="sl-block" data-block-type="shape" style="width: 346px; height: 157px; left: 29px; top: 420px;" data-block-id="0a183464aa8b010bd510f96b7593baf9">
<div class="sl-block-style" style="z-index: 15; opacity: 0.43;">
<div class="sl-block-content" data-shape-type="rect" data-shape-fill-color="rgb(109, 158, 235)" data-shape-stretch="true" style="z-index: 15;" data-shape-stroke-color="#000000" data-shape-stroke-width="5px">
<svg
xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 346 157">
<defs>
<clipPath id="shape-mask-3-1554466482566">
<rect width="346" height="157" rx="0" ry="0"></rect>
</clipPath>
</defs>
<rect width="346" height="157" rx="0" ry="0" clip-path="url(#shape-mask-3-1554466482566)" class="shape-element" fill="rgb(109, 158, 235)" stroke="#000000" stroke-width="10"></rect>
</svg>
</div>
</div>
</div>
@@
<!-- .slide: class="align-left" -->
## Répertoire de travail : checkout
![checkout](svg/checkout.svg)
Remplit le **working directory** avec le contenu du **commit** sur lequel on veut travailler.
@@
## Effectuer des changements
* Commencer à faire des modifications
* pas besoin de dire à GIT sur quels fichiers on travaille
* Il suffit juste de lui dire **quels changements sont à commiter**
```shell
$ git add <file>
$ git rm <file>
```
Que se passe-t-il si l'on fait un `git add` ?
@@
<!-- .slide: class="align-left" -->
## Ajout des modifications&nbsp;:&nbsp;add
![add](svg/add.svg)
**Staging area** ou **index** est l'endroit où le prochain commit est préparé.
@@
<!-- .slide: class="align-left" -->
## Validation &nbsp;:&nbsp;commit
![commit](svg/etats.svg)
`git commit` publie uniquement les changements présents dans la **staging area**.
Il peut rester des éléments modifiés dans le **working directory** qui ne seront pas inclus dans le **commit**.
@@
## En résumé : Cycle de vie des fichiers
![LifeCycle](svg/file_life_cycle.svg)
@@
<div class="sl-block" data-block-type="text" style="height: auto; width: 960px; left: 0px; top: 0px;" data-block-id="8322d4e648778865eccd4c70f8a6ee93">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 11;">
<h2>Historique des commits</h2>
</div>
</div>
<div class="sl-block" data-block-type="image" style="min-width: 4px; min-height: 4px; width: 394px; height: 431px; left: 55px; top: 200px;" data-block-id="2fc6951755d2590c4025cf8856e0be44">
<div class="sl-block-content" data-inline-svg="false" style="z-index: 12;">
<img src="svg/history.svg" style="" data-natural-width="53" data-natural-height="58"/>
</div>
</div>
<div class="sl-block" data-block-type="text" style="height: auto; min-width: 30px; min-height: 30px; width: 500px; left: 560px; top: 100px;" data-block-id="f68747d19f48eeb56f529a7cce1821a1">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 13;">
<p style="text-align:left">Les
<strong>commits </strong>ce succèdent les uns avec les autres.
</p>
<p style="text-align:left">&nbsp;</p>
<p style="text-align:left">Les flèches représentent les relations entre les commits.</p>
<p style="text-align:left">&nbsp;</p>
<p style="text-align:left">Une façon de consulter l'historique&nbsp;:</p>
<p style="text-align:left"><pre><code>$ git log
$ git log --oneline
$ git log --graph
$ gitk</code></pre></p>
</div>
</div>
<div class="sl-block" data-block-type="text" style="height: auto; min-width: 30px; min-height: 30px; width: 189px; left: 44px; top: 408px;" data-block-id="2b324b7be6c00f8e924bc9f1dc2231a5">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 14;">
<p>
<span style="font-size:0.7em">branche</span>
</p>
</div>
</div>
<div class="sl-block" data-block-type="line" style="width: auto; height: auto; min-width: 1px; min-height: 1px; left: 145px; top: 361px;" data-block-id="326851512e4254304b0c5ed6271c3c3f">
<div class="sl-block-content" data-line-x1="200" data-line-y1="54" data-line-x2="200" data-line-y2="0" data-line-color="#000000" data-line-start-type="none" data-line-end-type="arrow" style="z-index: 15;">
<svg
xmlns="http://www.w3.org/2000/svg" version="1.1" preserveAspectRatio="xMidYMid" width="1" height="54" viewBox="200 0 1 54">
<line stroke="rgba(0,0,0,0)" stroke-width="15" x1="200" y1="54" x2="200" y2="4"></line>
<line stroke="#000000" stroke-width="2" x1="200" y1="54" x2="200" y2="4"></line>
<polygon fill="#000000" transform="translate(200,4) rotate(0)" points="0,-4 4,4 -4,4"></polygon>
</svg>
</div>
</div>
<div class="sl-block" data-block-type="text" style="height: auto; min-width: 30px; min-height: 30px; width: 364px; left: 128px; top: 133px;" data-block-id="261c8f52670f2bd34a4f6d8c0787e13e">
<div class="sl-block-content" data-placeholder-tag="p" data-placeholder-text="Text" style="z-index: 16;">
<p>
<span style="font-size:0.7em">référence à la branche courante</span>
</p>
</div>
</div>
<div class="sl-block" data-block-type="line" style="width: auto; height: auto; min-width: 1px; min-height: 1px; left: 145px; top: 172px;" data-block-id="6a7ee40670f6c28d6694cc615687c04a">
<div class="sl-block-content" data-line-x1="261" data-line-y1="-16" data-line-x2="228" data-line-y2="11" data-line-color="#000000" data-line-start-type="none" data-line-end-type="arrow" style="z-index: 17;">
<svg
xmlns="http://www.w3.org/2000/svg" version="1.1" preserveAspectRatio="xMidYMid" width="33" height="27" viewBox="228 -16 33 27">
<line stroke="rgba(0,0,0,0)" stroke-width="15" x1="261" y1="-16" x2="231" y2="8"></line>
<line stroke="#000000" stroke-width="2" x1="261" y1="-16" x2="231" y2="8"></line>
<polygon fill="#000000" transform="translate(231,8) rotate(230.711)" points="0,-4 4,4 -4,4"></polygon>
</svg>
</div>
</div>