Benoît Seignovert2024-11-12(1) Comprendre comment marche GIT
(2) Versionner son premier projet
(3) Travailler sur plusieurs versions en parallèle
(4) Résoudre des conflits
expliqué simplement
Sans gestion de versions :
Avec gestion de versions :
Thèse-v1.txt
V2-Thèse.txt
V2-Thèse2.0.txt
V3-Thèse-final.txt
Thèse.txt
… mais avec un historique de versions
Bazaar
Bazaar
Créateur : Linus Torvalds
Première publication : 2005
Licence : GPLv2
75 000 contributions
1 700 contributeurs
1 000 versions publiées
Écrit en : C, C++, Perl, Tcl et Python
Git
SVN
I don't use one
Mercurial
97 %
6 %
1 %
1 %
53 374 réponses
de développeurs professionels
a.txt
aaaaa
a.txt
a.txt
a.txt
aaaaa
ccccc
aaaaa
bbbb
ccccc
aaaaa
bbbb
ccc
cc
+aaaaa
+ccccc
+bbbb
-cc
Initialisation
Ajout c x5
Ajout b x4
Suppression c x2
(natif)
(natif)
(à installer)
log
.git
.txt, .csv, .svg, .py, .R, …Éviter au maximum de versionner des binaires
ou des fichiers encapsulés !
.docx, .xlsx, .pptx, ….jpg, .png, .mp3, .avi, …img.jpg
010011001000011
img.jpg
img.jpg
img.jpg
+01001…
Initialisation
Resize
Crop
…
log
.git
101011110101010
+10101…
111011010001110
+11101…
011101110110100
💥
La réalité… 🤢
…c'est possible mais avec d'autres outils 🫣
(non abordé ici)
mainnew_branchcommit
a9bcb5ff
af3ad665
1dd6bccd
6d3e2ad4
ffe399e5
e52c486b
80a77b42
903d401c
146d4ee5
050b86b4
tag
v1v2merge
init
checkout
(hash)(principalement pour Windows)
git --version
> git version 2.47.0
git config --global user.name "John Doe"
git config --global user.email johndoe@example.comà la première utilisation uniquement
git init
git add a.txt
git commit -m "Initialisation du project"
git add b.txt
git commit -m "Ajout du fichier B"
git add a.txt c.txt
git commit -m "Ajout du fichier C et modification de A"
avec ungit
/chemin/vers/mon/projet/git-demogit initgit add 01-intro.txtgit commit -m "Premier commit"git add 01-intro.txt 02-examples.txtgit commit -m "Ajout d'un example"éviter de versionner les binaires!git add .gitignoregit commit -m "Ajout gitgnore"git tag v1git add 01-intro.txt 03-demo.txtgit commit -m "Ajout fichier demo"git add 03-demo.txtgit commit -m "Ajout contenu demo"git checkout v1git checkout -b correction-v1git add 01-intro.txtgit commit -m "Correction typos"git checkout maingit merge corrections-v1TBDPartie 1
mainnew_branchcommit
a9bcb5ff
af3ad665
1dd6bccd
6d3e2ad4
ffe399e5
e52c486b
80a77b42
903d401c
146d4ee5
050b86b4
tag
v1v2merge
init
checkout
(hash)Mercredi 13
Jeudi 14
Vendredi 15
Héberger ses codes sources sur une forge logicielle (Gitlab/Github)
Collaborer sur un projet open-source
Déployer des applications et des logiciels grâce à l'intégration continue
(13-14h)