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
Gregory Mounie
formation-git
Commits
370c4ecd
Commit
370c4ecd
authored
Sep 07, 2020
by
Grégory Mounié
Browse files
tags and branches (alpha)
parent
09ef2ada
Changes
1
Hide whitespace changes
Inline
Side-by-side
MOSIG_AdvancedBasic2h/git-model-computer-lab.tex
View file @
370c4ecd
...
...
@@ -231,62 +231,63 @@ back in the file history.
\section
{
The tags in the
\texttt
{
refs/
}
directory
}
\label
{
sec:tags
}
Les
tags
servent à étiqueter des révisions afin de pouvoir y revenir
directement en toute circonstance. Ils fonctionnent de la même manière
que les branches (voir plus loin) mais ne bougent pas avec la tête
.
The
tags
are given to a particular commit in order to find them again
later. They are quite similar to branches but never move their head
after their creation
.
Cr
éez un tag sur la révision suivante
~:
Cr
eate a tag on the current commit
~:
\begin{minted}
{
console
}
git tag v0.1
$
git tag v
0
.
1
\end
{
minted
}
Vérifiez que le fichier correspondant à ce tag a bien été créé dans le
dossier
\texttt
{
.git/refs/tags
}
et que son contenu correspond bien au
commit sur lequel est positionnée la tête actuellement~:
A new file appears in the
\texttt
{
.git
/
refs
/
tags
}
. Its content should
be the same as the current HEAD:
\begin
{
minted
}{
console
}
cat .git
/
refs
/
tags
/
v
0
.
1
\end
{
minted
}
No
us allons avancer la branc
he
\texttt
{
master
}
~:
No
w, move forward t
he
\texttt
{
master
}
branch
~:
\begin
{
minted
}{
console
}
mon
_
editeur
_
prefere
file2.txt # inser
er quelques
li
g
nes
git add file2.txt
git commit -m "message 4"
$
emacs
file2.txt # inser
t few
lines
$
git add file
2
.txt
$
git commit -m "message 4"
\end{minted}
Vérifiez dans le journal que la branche
\texttt
{
master
}
a bien avancé
et que le tag que vous avez créé précédemment est bien resté en place.
Check that the tag do not move.
\section
{
Les branches
}
\section
{
Branches
}
Create a new branch
\texttt
{
develop
}
, copy a file and commit.
Nous allons créer une nouvelle branche nommée
\texttt
{
develop
}
, puis
revenir dans la branche
\texttt
{
master
}
.
\begin{minted}
{
console
}
git checkout -b develop
cp file.txt file
_
copy2.txt
git add file
_
copy2.txt
git commit -m "message dev1"
$
git checkout
-
b develop
$
cp file.txt file
_
copy2.txt
$
git add file
_
copy
2
.txt
$
git commit -m "message dev1"
\end{minted}
Vérifier que HEAD pointe bien sur le bon commit de
\texttt
{
develop
}
.
Check that HEAD points on the right commit of the
\texttt
{
develop
}
branch.
Then, come back on the
\texttt
{
master
}
branch and do exactly the same
modification.
\begin{minted}
{
console
}
git checkout master
cp file.txt file
_
copy2.txt
git add file
_
copy2.txt
git commit -m "message 5"
$
git checkout master
$
cp file.txt file
_
copy2.txt
$
git add file
_
copy
2
.txt
$
git commit -m "message 5"
\end{minted}
Vérifier que HEAD pointe bien sur le bon
commit
d
e
\texttt
{
master
}
.
Check that HEAD points on the right
commit
of th
e
\texttt
{
master
}
branch
.
Et nous allons faire le merge (sauvegarder sans modifier le message)
And now merge the
\texttt
{
develop
}
branch in master.
\begin{minted}
{
console
}
git merge develop
\end{minted}
Vérifier que le commit a bien deux parents et que l
e tree
pointe ver
s
le même fichier
.
Check that the commit has two parents and the all th
e t
h
ree
tree
s
point to the same file
.
\section
{
Git perd la tête~?
}
...
...
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