-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aea6617
commit 982abf1
Showing
19 changed files
with
318 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <file>..." to include in what will be committed) | ||
|
||
testFile.txt | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <file>..." to unstage) | ||
|
||
new file: testFile.txt | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <vallettea@gmail.com> | ||
Date: Mon Jan 11 19:53:32 2016 +0100 | ||
|
||
changed hello in bonjour | ||
|
||
commit 2dc24bc314fc92fcbf20261ef80ec203088044d9 | ||
Author: vallettea <vallettea@gmail.com> | ||
Date: Mon Jan 11 19:32:26 2016 +0100 | ||
|
||
added hello to the file | ||
|
||
commit c04b81108300ebbe9d367d21c603ae9e3089d55e | ||
Author: vallettea <vallettea@gmail.com> | ||
Date: Mon Jan 11 19:22:51 2016 +0100 | ||
|
||
added empty file to project | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/) | ||
|