... | @@ -219,7 +219,9 @@ nothing to commit, working tree clean |
... | @@ -219,7 +219,9 @@ nothing to commit, working tree clean |
|
MacBook-Air-749:4git sebastienjean$
|
|
MacBook-Air-749:4git sebastienjean$
|
|
```
|
|
```
|
|
|
|
|
|
### Visualisation de l'historique
|
|
## Manipulation de l'historique
|
|
|
|
|
|
|
|
## Visualisation de l'historique
|
|
|
|
|
|
La commande `git log` permet de voir l'historique de façon exhaustive et d'y retrouver les pointeurs :
|
|
La commande `git log` permet de voir l'historique de façon exhaustive et d'y retrouver les pointeurs :
|
|
|
|
|
... | @@ -242,3 +244,45 @@ MacBook-Air-749:4git sebastienjean$ git log --pretty="format:%h %s" |
... | @@ -242,3 +244,45 @@ MacBook-Air-749:4git sebastienjean$ git log --pretty="format:%h %s" |
|
146f51a ajout d'un fichier
|
|
146f51a ajout d'un fichier
|
|
MacBook-Air-749:4git sebastienjean$
|
|
MacBook-Air-749:4git sebastienjean$
|
|
```
|
|
```
|
|
|
|
|
|
|
|
### Comparaison de versions
|
|
|
|
|
|
|
|
On considère que l'on édite le contenu du fichier précédent en modifiant le texte sur la première ligne pour produire le résultat suivant :
|
|
|
|
|
|
|
|
```
|
|
|
|
MacBook-Air-749:4git sebastienjean$ more unFichier.txt
|
|
|
|
Une autre ligne de texte
|
|
|
|
MacBook-Air-749:4git sebastienjean$
|
|
|
|
```
|
|
|
|
|
|
|
|
la commande `git status` va, sans surprise, faire état d'un changement (consigné dans _unstaged_) :
|
|
|
|
|
|
|
|
```
|
|
|
|
MacBook-Air-749:4git sebastienjean$ git status
|
|
|
|
On branch master
|
|
|
|
Changes not staged for commit:
|
|
|
|
(use "git add <file>..." to update what will be committed)
|
|
|
|
(use "git restore <file>..." to discard changes in working directory)
|
|
|
|
modified: unFichier.txt
|
|
|
|
|
|
|
|
no changes added to commit (use "git add" and/or "git commit -a")
|
|
|
|
MacBook-Air-749:4git sebastienjean$
|
|
|
|
```
|
|
|
|
|
|
|
|
__N.B.__ : ici, le fichier est déjà connu.
|
|
|
|
|
|
|
|
La commande `git diff`, sans paramètre, nous permet de comparer le _working tree_ et la version `HEAD` (et ainsi voir tout ce qui est déclaré _unstaged_) :
|
|
|
|
|
|
|
|
```diff
|
|
|
|
MacBook-Air-749:4git sebastienjean$ git diff
|
|
|
|
diff --git a/unFichier.txt b/unFichier.txt
|
|
|
|
index 927b61b..ee051bd 100644
|
|
|
|
--- a/unFichier.txt
|
|
|
|
+++ b/unFichier.txt
|
|
|
|
@@ -1 +1 @@
|
|
|
|
-Une ligne de texte
|
|
|
|
+Une autre ligne de texte
|
|
|
|
MacBook-Air-749:4git sebastienjean$
|
|
|
|
```
|
|
|
|
|
|
|
|
Pour chaque changement sur un fichier, une description des changements à la syntaxe _diff_ est produite. Elle fusionne les 2 versions du fichier et note les endroits des changements. L'outil _diff_ ne travaille qu'au niveau d'un ligne (pas au niveau de son contenu), ainsi une modification sur une ligne à l'endroit désigné du fichier est vue comme la suppression (`-`) de la ligne et l'ajout (`+`) d'une autre ligne (cf. documentation pour plus de détails) |
|
|
|
\ No newline at end of file |