Skip to content
Snippets Groups Projects
Commit 36dbad48 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

en train de travailler sur le reset

parent 4f37fa08
No related branches found
No related tags found
No related merge requests found
% Introduction à Git
% Orestis Malaspinas
% Version
# Des références
......@@ -194,11 +196,105 @@ Date: Sun Mar 4 22:25:24 2018 +0100
mon premier commit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Revenir en arrière dans l'historique (1/3)
# Revenir en arrière dans l'historique (1/5)
## Commandes: `git checkout`, `git reset`
1. Faire une modification dans un fichier qu'on aurait pas faire.
1. Faire une modification dans un fichier qu'on aurait pas voulu faire.
2. Faire un `git add` qu'on aurait pas dû faire.
3. Faire un `git commit` qu'on aurait pas dû faire.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines}
[tutorial]$ echo Oh no! An awful modification! > premierfichier.c
[tutorial]$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: premierfichier.c
no changes added to commit (use "git add" and/or "git commit -a")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Revenir en arrière dans l'historique (2/5)
## Commandes: `git checkout`, `git reset`
### Une modification dans un fichier qu'on aurait pas voulu faire.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines}
[tutorial]$ git checkout premierfichier.c
[tutorial]$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Revenir en arrière dans l'historique (3/5)
## Commandes: `git checkout`, `git reset`
### Faire un `git add` qu'on aurait pas dû faire.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines}
[tutorial]$ echo Oh no! An awful modification! > premierfichier.c
[tutorial]$ git add premierfichier.c
[tutorial]$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: premierfichier.c
[tutorial]$ git reset HEAD
Unstaged changes after reset:
M premierfichier.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Revenir en arrière dans l'historique (4/5)
## Commandes: `git checkout`, `git reset`
### Faire un `git add` qu'on aurait pas dû faire.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines}
[tutorial]$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: premierfichier.c
no changes added to commit (use "git add" and/or "git commit -a")
[tutorial]$ git diff
diff --git a/premierfichier.c b/premierfichier.c
index 9622e40..cfd5469 100644
--- a/premierfichier.c
+++ b/premierfichier.c
@@ -1 +1 @@
-Wild World
+Oh no! An awful modification!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Revenir en arrière dans l'historique (4/5)
## Commandes: `git checkout`, `git reset`
### Faire un `git commit` qu'on aurait pas dû faire.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines}
[tutorial]$ git commit -am "troisieme commit"
[master 0563c02] troisieme commit
1 file changed, 1 insertion(+), 1 deletion(-)
[tutorial]$ git reset f9ab3ec4a00c46a12d7a45f133295acc5fb5cd20
[tutorial]$ git checkout premierfichier.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment