Skip to content

Commit

Permalink
End of git slides
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBruant committed Feb 22, 2016
1 parent aea6617 commit 982abf1
Show file tree
Hide file tree
Showing 19 changed files with 318 additions and 0 deletions.
19 changes: 19 additions & 0 deletions slides/03-git-github/08-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$background:#4d7e65$

## Status

<style>pre{background: #3f3f3f;}</style>

````bash
git status
````

donne:

````bash
On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)
````
18 changes: 18 additions & 0 deletions slides/03-git-github/09-status-untracked.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$background:#4d7e65$

## Status

<style>pre{background: #3f3f3f;}</style>

````bash
touch testFile.txt
````

après ce fichier crée, `git status` donne:

````bash
Untracked files:
(use "git add &lt;file>..." to include in what will be committed)

testFile.txt
````
18 changes: 18 additions & 0 deletions slides/03-git-github/10-git-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$background:#4d7e65$

## git add

<style>pre{background: #3f3f3f;}</style>

````bash
git add testFile.txt
````

indique a git qu'on veut le versioner

````bash
Changes to be committed:
(use "git rm --cached &lt;file>..." to unstage)

new file: testFile.txt
````
19 changes: 19 additions & 0 deletions slides/03-git-github/11-git-commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$background:#4d7e65$

## git commit

<style>pre{background: #3f3f3f;}</style>

````bash
git commit
````

ouvre un éditeur (vim, nano) pour décrire le commit.

Une alternative rapide:

````bash
git commit -m "added empty file to project"
````

faites un `git status` pour voir...
14 changes: 14 additions & 0 deletions slides/03-git-github/12-iterer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$background:#4d7e65$

## Itérer

<style>pre{background: #3f3f3f;}</style>

On itère au fur et a mesure des changements qu'on veut persister :

````bash
// on ajoute une ligne au fichier (normalement utiliser l'éditeur)
echo "hello" > testFile.txt
git status
git commit -am"added hello to the file"
````
18 changes: 18 additions & 0 deletions slides/03-git-github/13-git-diff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$background:#4d7e65$

## git diff

<style>pre{background: #3f3f3f;}</style>

faites une modification

````bash
git diff
````

indique les changements par rapport au dernier commit

````bash
-hello
+bonjour
````
9 changes: 9 additions & 0 deletions slides/03-git-github/14-resume.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$background:#4d7e65$

## Résumé

<style>.reveal section img { background: none; border: none; box-shadow: none;}</style>

Chaque commit permet de poser une bouée pour repérer un état du code.

<img width="300" data-src="https://www.atlassian.com/wac/landing/git/tutorial/pageSections/00/pageSections/0/contentColumnTwo/0/imageBinary/git_training-basics.png" alt="Down arrow">
31 changes: 31 additions & 0 deletions slides/03-git-github/15-git-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
$background:#4d7e65$

## git log

<style>pre{background: #3f3f3f;}</style>

Pour avoir une vue de l'histoire.

````bash
git log
````

````bash
commit 5bf345af8448979acd16ec07621561f8628211fa
Author: vallettea &lt;vallettea@gmail.com>
Date: Mon Jan 11 19:53:32 2016 +0100

changed hello in bonjour

commit 2dc24bc314fc92fcbf20261ef80ec203088044d9
Author: vallettea &lt;vallettea@gmail.com>
Date: Mon Jan 11 19:32:26 2016 +0100

added hello to the file

commit c04b81108300ebbe9d367d21c603ae9e3089d55e
Author: vallettea &lt;vallettea@gmail.com>
Date: Mon Jan 11 19:22:51 2016 +0100

added empty file to project
````
19 changes: 19 additions & 0 deletions slides/03-git-github/16-git-checkout-commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$background:#4d7e65$

## git checkout \#commit

<style>pre{background: #3f3f3f;}</style>

Pour se déplacer dans l'histoire

````bash
git checkout 2dc24bc314f
````

Si vous regardez votre fichier, vous verrez qu'il est revenu à l'état où il y avait hello. Pour revenir au dernier état

````bash
git checkout master
````

**Attention**: pour se déplacer dans l'histoire, il faut être "clean", c'est-à-dire ne pas avoir de modifications non-commitées.
17 changes: 17 additions & 0 deletions slides/03-git-github/17-git-checkout-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$background:#4d7e65$

## git checkout \#commit

<style>pre{background: #3f3f3f;}</style>

Pour revenir au dernier commit pour ce fichier

````bash
git checkout testFile.txt
````

Pour faire la même chose avec tous les fichiers à la fois (dans le cas d'un projet complet):

````bash
git checkout --hard HEAD
````
29 changes: 29 additions & 0 deletions slides/03-git-github/18-git-branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$background:#4d7e65$

## git branch

<style>pre{background: #3f3f3f;}</style>

Pour créer une nouvelle branche

````bash
git branch new-version
````

Lister les branches

````bash
git branch
````

Se mettre sur une branche existante

```bash
git checkout other-version
```

Créer une nouvelle branche et aller dessus

````bash
git checkout -b newest-version
````
9 changes: 9 additions & 0 deletions slides/03-git-github/18-resume-histoire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$background:#4d7e65$

## Résumé

<style>.reveal section img { background: none; border: none; box-shadow: none;}</style>

On utilise log et checkout pour naviguer dans l'histoire des commits

<img width="300" data-src="https://www.atlassian.com/wac/landing/git/tutorial/pageSections/00/pageSections/00/contentColumnTwo/0/imageBinary/git-training-undoing-changes.png" alt="Down arrow">
22 changes: 22 additions & 0 deletions slides/03-git-github/19-voir-branches.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$background:#4d7e65$

## git branch

<style>pre{background: #3f3f3f;}</style>

Pour voir où on en est

````bash
git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short --all
````

donne:

````bash
* ae5830b 2016-01-11 | added a third file (HEAD -> newVersion) [vallettea]
| * 58f41af 2016-01-11 | added a second file (master) [vallettea]
|/
* 5bf345a 2016-01-11 | changed hello in bonjour [vallettea]
* 2dc24bc 2016-01-11 | added hello to the file [vallettea]
* c04b811 2016-01-11 | added empty file to project [vallettea]
````
9 changes: 9 additions & 0 deletions slides/03-git-github/20-resume-branches.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$background:#4d7e65$

## Résumé branches

<style>.reveal section img { background: none; border: none; box-shadow: none;}</style>

Les branches permettent d'organiser ses modifications

<img width="300" data-src="https://www.atlassian.com/wac/landing/git/tutorial/pageSections/00/pageSections/01/contentColumnTwo/0/imageBinary/git-tutorial-branching-merge-1.png" alt="Down arrow">
17 changes: 17 additions & 0 deletions slides/03-git-github/21-git-merge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$background:#4d7e65$

## git merge

<style>pre{background: #3f3f3f;}</style>

Remettons nous sur master

````bash
git checkout master
````

et apportons tous les changements fait sur `new-version` sur master

````bash
git merge newVersion
````
24 changes: 24 additions & 0 deletions slides/03-git-github/22-apres-merge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$background:#4d7e65$

## après le merge

<style>pre{background: #3f3f3f;}</style>

Pour voir où on en est

````
git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short --all
````

donne

````
* 867fdd6 2016-01-11 | Merge branch 'newVersion' (HEAD -> master) [vallettea]
|\
| * ae5830b 2016-01-11 | added a third file (newVersion) [vallettea]
* | 58f41af 2016-01-11 | added a second file [vallettea]
|/
* 5bf345a 2016-01-11 | changed hello in bonjour [vallettea]
* 2dc24bc 2016-01-11 | added hello to the file [vallettea]
* c04b811 2016-01-11 | added empty file to project [vallettea]
````
9 changes: 9 additions & 0 deletions slides/03-git-github/23-resume-merge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$background:#4d7e65$

## Résumé merge

<style>.reveal section img { background: none; border: none; box-shadow: none;}</style>

Merger sert a faire converger les modifications crées sur les branches vers une version finale.

<img width="300" data-src="https://www.atlassian.com/wac/landing/git/tutorial/pageSections/00/pageSections/02/contentColumnTwo/0/imageBinary/git-tutorial-rewriting-history-1.png" alt="Down arrow">
7 changes: 7 additions & 0 deletions slides/03-git-github/24-plus-loin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
$background:#4d7e65$

### Pour aller plus loin

* git stash
* .gitignore
* [alias dans .gitconfig](http://gitimmersion.com/lab_11.html)
10 changes: 10 additions & 0 deletions slides/03-git-github/25-ressources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$background:#4d7e65$

### Ressources

* [doc officielle](http://www.git-scm.com/doc)
* [tutorial interactif](http://pcottle.github.io/learnGitBranching/)
* [git command line simulator](https://try.github.io/levels/1/challenges/1)
* [bon tutorial](http://gitimmersion.com)
* [autre bonne documentation](https://www.atlassian.com/pt/git/)

0 comments on commit 982abf1

Please sign in to comment.