Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Picasoft
APIs
Init
Git
Commits
9b54a3f7
Unverified
Commit
9b54a3f7
authored
Jan 11, 2019
by
Rémy Huet
💻
Browse files
Merge branch 'utiliser_versions'
parents
0356bf15
8cd0a97f
Pipeline
#33302
passed with stages
in 52 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/tex/utiliser_versions/annuler_commits.tex
View file @
9b54a3f7
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Sans modification d'historique
}
\begin{block}
{}
\enquote
{
Dis, je me suis planté sur un commit, j'aimerais bien l'annuler
\ldots
C'est possible ?
\\
Oui ! Utilises git revert !
}
\end{block}
\verb
+
git revert
+
permet d'annuler un commit, en en créant un commit qui fait les modifications inverses.
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git revert HEAD
\Pause
[
master
6
e
23
b
65
]
Revert "Troisième commit"
1
file changed,
1
deletion
(-)
\end
{
Verbatim
}
\end
{
beamercolorbox
}
\end
{
frame
}
\begin
{
frame
}
[
fragile
]
\begin
{
beamercolorbox
}
[
rounded
=
true, shadow
=
true
]
{
terminal
}
\begin
{
Verbatim
}
\textcolor
{
yellow
}{
commit
6
e
23
b
65243628
f
81924
f
650466
c
86
ef
3
a
8
e
42
ec
5
(
}{
\bf\textcolor
{
cyan
}{
HEAD
-
>
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
Author: huetremy <remy.huet@etu.utc.fr>
Date: Fri Jan
11
14
:
20
:
59
2019
+
0100
Revert "Troisième commit"
This reverts commit a
04
da
653083
b
6
b
0
ba
3
eea
2
bce
98
d
903
acfd
0
a
4
d
3
.
diff
--
git a
/
API.txt b
/
API.txt
index a
03
f
78
c..
5596950
100644
---
a
/
API.txt
+++
b
/
API.txt
\textcolor
{
cyan
}{
@@
-
1
,
3
+
1
,
2
@@
}
Je suis le premier fichier utilisé pour cette API sur git
J'ajoute une ligne à mon fichier
\textcolor
{
red
}{
-
Encore une ligne en plus
!
}
\Pause
$
git diff HEAD
\~
{}
2
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Avec modification d'historique
}
\framesubtitle
{
Git reset
}
\begin{block}
{
À quoi ça sert ?
}
\begin{itemize}
\item
\verb
+
git reset
+
permet de remettre le HEAD dans un état spécifique, et modifie l'arbre en conséquence (supprime tous les commits après)
\item
\verb
+
git reset --soft
+
laisse le working directory dans l'état dans lequel il était
\item
\verb
+
git reset --hard
+
remet le working directory dans l'état du commit sur lequel on reset.
\end{itemize}
\end{block}
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git reset
--
soft HEAD~
1
\Pause
$
cat API.txt
\Pause
Je suis le premier fichier utilisé pour cette API sur git
J'ajoute une ligne à mon fichier
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
\begin{frame}
[fragile]
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git log
--
graph
--
decorate
--
all
\Pause
*
\textcolor
{
yellow
}{
commit a
04
da
653083
b
6
b
0
ba
3
eea
2
bce
98
d
903
acfd
0
a
4
d
3
(
}{
\bf\textcolor
{
cyan
}{
HEAD
-
>
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: huetremy <remy.huet@etu.utc.fr>
\textcolor
{
red
}{
|
}
Date: Fri Jan
11
10
:
16
:
10
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Troisième commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit
5
b
63
bd
1
f
9
afe
4685
b
60074030960
e
39
bb
5152
e
67
}
\textcolor
{
red
}{
|
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
\textcolor
{
red
}{
|
}
Date: Thu Jan
3
15
:
55
:
33
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Second commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit
712951
dbb
3
ee
0
cc
4
d
248582
dc
5408
da
3
afdec
853
(
tag: mon
_
tag
)
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
Date: Thu Jan
3
15
:
37
:
54
2019
+
0100
Ajout du premier fichier
\end
{
Verbatim
}
\end
{
beamercolorbox
}
On voit bien grâce qux deux commandes précédentes que le commit a été supprimé mais que les modifications ont été gardées
\ldots
Maintenant :
\begin
{
beamercolorbox
}
[
rounded
=
true, shadow
=
true
]
{
terminal
}
\begin
{
Verbatim
}
$
git commit -am ''Commit de revert''
\Pause
[master eae33f2] Commit de revert
1 file changed, 1 deletion(-)
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
\begin{frame}
\begin{frame}
[fragile]
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git reset
--
hard HEAD~
1
\Pause
HEAD est maintenant à a
04
da
65
Troisième commit
\Pause
$
cat API.txt
\Pause
Je suis le premier fichier utilisé pour cette API sur git
J'ajoute une ligne à mon fichier
Encore une ligne en plus !
\Pause
$
git log
--
graph
--
decorate
--
all
\Pause
*
\textcolor
{
yellow
}{
commit a
04
da
653083
b
6
b
0
ba
3
eea
2
bce
98
d
903
acfd
0
a
4
d
3
(
}{
\bf\textcolor
{
cyan
}{
HEAD
-
>
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: huetremy <remy.huet@etu.utc.fr>
\textcolor
{
red
}{
|
}
Date: Fri Jan
11
10
:
16
:
10
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Troisième commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit
5
b
63
bd
1
f
9
afe
4685
b
60074030960
e
39
bb
5152
e
67
}
\textcolor
{
red
}{
|
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
\textcolor
{
red
}{
|
}
Date: Thu Jan
3
15
:
55
:
33
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Second commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit
712951
dbb
3
ee
0
cc
4
d
248582
dc
5408
da
3
afdec
853
(
tag: mon
_
tag
)
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
Date: Thu Jan
3
15
:
37
:
54
2019
+
0100
Ajout du premier fichier
\end
{
Verbatim
}
\end
{
beamercolorbox
}
Le commit a bien été effacé, mais cette fois les modifications n'ont pas été gardées
\end
{
frame
}
\begin
{
frame
}
[
fragile
]
\frametitle
{
Avec modification d'historique
}
\framesubtitle
{
Git commit
--
amend
}
\begin
{
block
}{}
\enquote
{
Dis, j'aimerais faire une toute petite modification sur un commit, c'est possible ?
\\
--
Oui
!
Utilises git commit
\-
-
\-
-
ammend
}
\end
{
block
}
\verb
+
git commit
--
ammend
+
permet de modifier un commit
(
tant son message que son contenu, son auteur
\ldots
)
\begin
{
beamercolorbox
}
[
rounded
=
true, shadow
=
true
]
{
terminal
}
\begin
{
Verbatim
}
$
echo "Je suis l'apiinit" >> API.txt
&&
git commit -am "Commit supplémentaire"
\Pause
$
sed
-
i "s|apiinit|Api
/
casoft init|" API.txt
\Pause
$
git commit -a --amend
\Pause
[master 168efba] Commit supplémentaire
Date: Fri Jan 11 14:53:09 2019 +0100
1 file changed, 1 insertion(+)
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
\begin{frame}
[fragile]
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git log
--
graph
--
decorate
\Pause
*
\textcolor
{
yellow
}{
commit
168
efba
77
dcfd
59
ba
4346
fe
4
a
34427
b
71
db
75
da
7
(
}{
\bf\textcolor
{
cyan
}{
HEAD
-
>
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: huetremy <remy.huet@etu.utc.fr>
\textcolor
{
red
}{
|
}
Date: Fri Jan
11
14
:
53
:
09
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Commit supplémentaire
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit a
04
da
653083
b
6
b
0
ba
3
eea
2
bce
98
d
903
acfd
0
a
4
d
3
}
\textcolor
{
red
}{
|
}
Author: huetremy <remy.huet@etu.utc.fr>
\textcolor
{
red
}{
|
}
Date: Fri Jan
11
10
:
16
:
10
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Troisième commit
\textcolor
{
red
}{
|
}
[
\ldots
]
\Pause
$
git show HEAD
\Pause
\textcolor
{
yellow
}{
commit 168efba77dcfd59ba4346fe4a34427b71db75da7 (
}{
\bf\textcolor
{
cyan
}{
HEAD ->
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
Author: huetremy <remy.huet@etu.utc.fr>
Date: Fri Jan 11 14:53:09 2019 +0100
Commit supplémentaire
{
\bf
{}
diff --git a/API.txt b/API.txt
}
{
\bf
{}
index a03f78c..4af702a 100644
}
{
\bf
{}
--- a/API.txt
}
{
\bf
{}
+++ b/API.txt
}
\textcolor
{
cyan
}{
@@ -1,3 +1,4 @@
}
Je suis le premier fichier utilisé pour cette API sur git
J'ajoute une ligne à mon fichier
Encore une ligne en plus !
\textcolor
{
myGreen
}{
+Je suis l'Api/casoft init
}
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
src/tex/utiliser_versions/head.tex
View file @
9b54a3f7
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Qu'est-ce que le HEAD?
}
Le HEAD est l'
{
\it
état courant
}
du repository.
On peut le voir comme le commit sur lequel
\enquote
{
on se situe
}
.
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git log
--
graph
--
decorate
\Pause
*
\textcolor
{
yellow
}{
commit
5
b
63
bd
1
f
9
afe
4685
b
60074030960
e
39
bb
5152
e
67
(
}{
\bf
\textcolor
{
cyan
}{
HEAD
-
>
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
\textcolor
{
red
}{
|
}
Date: Thu Jan
3
15
:
55
:
33
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Second commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit
712951
dbb
3
ee
0
cc
4
d
248582
dc
5408
da
3
afdec
853
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
Date: Thu Jan
3
15
:
37
:
54
2019
+
0100
Ajout du premier fichier
\end
{
Verbatim
}
\end
{
beamercolorbox
}
\begin
{
block
}{
Pointer avant le HEAD
}
HEAD est une
{
\bf
etiquette
}
sur un commit.
Pour pointer sur le commit avant HEAD, on peut utiliser
{
\bf
\verb
+
HEAD~
1
+
}
{
\it
(
\verb
+
~
2
+
pour deux commits
\ldots
)
}
\end
{
block
}
\end
{
frame
}
src/tex/utiliser_versions/marquer_version.tex
View file @
9b54a3f7
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Git tag
}
\begin{block}
{
Qu'est ce qu'un tag ?
}
Un tag est
{
\bf
une etiquette
}
sur un commit.
Il permet par exemple de marquer une version particulière du projet (une
{
\it
release
}
)
\end{block}
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git tag mon
_
tag HEAD~
1
\Pause
$
git log --graph --decorate
\Pause
*
\textcolor
{
yellow
}{
commit 5b63bd1f9afe4685b60074030960e39bb5152e67 (
}{
\bf\textcolor
{
cyan
}{
HEAD ->
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
\textcolor
{
red
}{
|
}
Date: Thu Jan 3 15:55:33 2019 +0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Second commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit 712951dbb3ee0cc4d248582dc5408da3afdec853 (tag: mon
_
tag)
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
Date: Thu Jan 3 15:37:54 2019 +0100
Ajout du premier fichier
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
src/tex/utiliser_versions/mettre_de_cote.tex
View file @
9b54a3f7
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Enregistrer les modifications locales
}
\begin{block}
{}
\enquote
{
Je peux avoir la dernière version du projet ?
\\
-- Euh, là non j'ai fait des modifications qui ne fonctionnent pas
\ldots
\\
-- Fais un git stash !
}
\end{block}
\verb
+
git stash
+
permet de
{
\bf
mettre de côté
}
des modifications non validées.
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
echo 'Encore une ligne en plus
!
' >> API.txt
\Pause
$
cat API.txt
\Pause
Je suis le premier fichier utilisé pour cette API sur git
J'ajoute une ligne à mon fichier
Encore une ligne en plus !
\Pause
$
git stash
\Pause
Copie de travail et état de l'index sauvegardés dans WIP on master:
5
b
63
bd
1
Second commit
\Pause
$
cat API.txt
\Pause
Je suis le premier fichier utilisé pour cette API sur git
J'ajoute une ligne à mon fichier
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Restaurer les modifications locales
}
\begin{block}
{}
\enquote
{
Et comment je les récupère maintenant ?
\\
-- Facile ! git stash pop !
}
\end{block}
\verb
+
git stash pop
+
permet de réappliquer les modifications qui avaient été mises de côté.
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git stash pop
\Pause
Sur la branche master
Votre branche est à jour avec 'origin
/
master'.
Modifications qui ne seront pas validées :
(
utilisez "git add <fichier>..." pour mettre à jour ce qui sera validé
)
(
utilisez "git checkout
--
<fichier>..." pour annuler les modifications dans la copie de travail
)
\textcolor
{
red
}{
modifié : API.txt
}
aucune modification n'a été ajoutée à la validation
(
utilisez "git add" ou "git commit
-
a"
)
refs
/
stash@
{
0
}
supprimé
(
c
0
c
5
cd
92988
e
5
f
78
a
8
c
929
e
7
fd
3
bb
34
bb
1067
fda
)
\Pause
$
git commit -am ''Troisième commit''
\Pause
[master a04da65] Troisième commit
1 file changed, 1 insertion(+)
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
src/tex/utiliser_versions/parcourir_historique.tex
View file @
9b54a3f7
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Changer de version
}
\begin{block}
{}
\enquote
{
Dis, la prof nous demande la version de la semaine dernière, comment je peux la récupérer ?
-- Utilises git checkout !
}
\end{block}
\verb
+
git checkout
+
permet de déplacer le
\verb
+
HEAD
+
sur un commit via son sha ou une etiquette (un tag par exemple)
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git log
--
graph
--
decorate
\Pause
*
\textcolor
{
yellow
}{
commit a
04
da
653083
b
6
b
0
ba
3
eea
2
bce
98
d
903
acfd
0
a
4
d
3
(
}{
\bf\textcolor
{
cyan
}{
HEAD
-
>
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: huetremy <remy.huet@etu.utc.fr>
\textcolor
{
red
}{
|
}
Date: Fri Jan
11
10
:
16
:
10
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Troisième commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit
5
b
63
bd
1
f
9
afe
4685
b
60074030960
e
39
bb
5152
e
67
}
\textcolor
{
red
}{
<
----
Cette version là
!
}
\textcolor
{
red
}{
|
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
\textcolor
{
red
}{
|
}
Date: Thu Jan
3
15
:
55
:
33
2019
+
0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Second commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit
712951
dbb
3
ee
0
cc
4
d
248582
dc
5408
da
3
afdec
853
(
tag: mon
_
tag
)
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
Date: Thu Jan
3
15
:
37
:
54
2019
+
0100
Ajout du premier fichier
\end
{
Verbatim
}
\end
{
beamercolorbox
}
\end
{
frame
}
\begin{frame}
\begin
{
frame
}
[
fragile
]
\begin
{
beamercolorbox
}
[
rounded
=
true, shadow
=
true
]
{
terminal
}
\begin
{
Verbatim
}
$
git checkout HEAD
\~
{}
1
\Pause
Note : extraction de 'HEAD~1'.
Vous êtes dans l'état « HEAD détachée ». Vous pouvez visiter, faire des modifications
expérimentales et les valider. Il vous suffit de faire une autre extraction pour
abandonner les commits que vous faites dans cet état sans impacter les autres branches
Si vous voulez créer une nouvelle branche pour conserver les commits que vous créez,
il vous suffit d'utiliser « checkout -b » (maintenant ou plus tard) comme ceci :
git checkout -b <nom-de-la-nouvelle-branche>
HEAD est maintenant sur 5b63bd1 Second commit
\Pause
$
git status
\Pause
\textcolor
{
red
}{
HEAD détachée sur
}
5
b
63
bd
1
rien à valider, la copie de travail est propre
\Pause
$
git log --graph --decorate --all
\Pause
*
\textcolor
{
yellow
}{
commit a04da653083b6b0ba3eea2bce98d903acfd0a4d3 (
}{
\bf\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: huetremy <remy.huet@etu.utc.fr>
\textcolor
{
red
}{
|
}
Date: Fri Jan 11 10:16:10 2019 +0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Troisième commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit 5b63bd1f9afe4685b60074030960e39bb5152e67 (
}{
\bf\textcolor
{
cyan
}{
HEAD
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
\textcolor
{
red
}{
|
}
Date: Thu Jan 3 15:55:33 2019 +0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Second commit
\textcolor
{
red
}{
|
}
[
\ldots
]
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
\begin{frame}
[fragile]
\frametitle
{
Revenir au dernier commit
}
\begin{block}
{}
\enquote
{
Et comment je retourne à ma version ?
}
\end{block}
\Pause
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
git checkout master
\Pause
La position précédente de HEAD était sur
5
b
63
bd
1
Second commit
Basculement sur la branche 'master'
Votre branche est à jour avec 'origin
/
master'.
\Pause
$
git log --graph --decorate
\Pause
*
\textcolor
{
yellow
}{
commit a04da653083b6b0ba3eea2bce98d903acfd0a4d3 (
}{
\bf\textcolor
{
cyan
}{
HEAD ->
}
\textcolor
{
green
}{
master
}}
\textcolor
{
yellow
}{
)
}
\textcolor
{
red
}{
|
}
Author: huetremy <remy.huet@etu.utc.fr>
\textcolor
{
red
}{
|
}
Date: Fri Jan 11 10:16:10 2019 +0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Troisième commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit 5b63bd1f9afe4685b60074030960e39bb5152e67
}
\textcolor
{
red
}{
|
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
\textcolor
{
red
}{
|
}
Date: Thu Jan 3 15:55:33 2019 +0100
\textcolor
{
red
}{
|
}
\textcolor
{
red
}{
|
}
Second commit
\textcolor
{
red
}{
|
}
*
\textcolor
{
yellow
}{
commit 712951dbb3ee0cc4d248582dc5408da3afdec853 (tag: mon
_
tag)
}
Author: Thibaud Duhautbout <thibaud@duhautbout.ovh>
Date: Thu Jan 3 15:37:54 2019 +0100
Ajout du premier fichier
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
\begin{frame}
\begin{frame}
[fragile]
\frametitle
{
Annuler des changements
}
\begin{block}
{}
\enquote
{
Dis, j'ai fait des modifications qui ont tout cassé, y'a moyen de revenir en arrière ?
\\
-- Oui ! git checkout
\-
-
\-
-
}
\end{block}
\verb
+
git checkout -- <fichier/dossier>
+
permet de remettre un fichier ou un dossier dans l'état du dernier commit
\begin{beamercolorbox}
[rounded=true, shadow=true]
{
terminal
}
\begin{Verbatim}
$
echo 'Ligne qui casse tout' | cat | cat | cat > API.txt
\Pause
$
git diff
\Pause
{
\bf
{}
diff --git a/API.txt b/API.txt
}
{
\bf
{}
index a03f78c..85468b3 100644
}
{
\bf
{}
--- a/API.txt
}
{
\bf
{}
+++ b/API.txt
}
\textcolor
{
cyan
}{
@@ -1,3 +1 @@
}
\textcolor
{
red
}{
-Je suis le premier fichier utilisé pour cette API sur git
}
\textcolor
{
red
}{
-J'ajoute une ligne à mon fichier
}
\textcolor
{
red
}{
-Encore une ligne en plus !
}
\textcolor
{
myGreen
}{
+Ligne qui casse tout
}
\Pause
$
git checkout
--
API.txt
\Pause
$
git diff
\Pause
\end{Verbatim}
\end{beamercolorbox}
\end{frame}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment