Cedric Gatay - [email protected]
Git pour tousvraiment tous…
Cedric Gatay - [email protected]
Cedric Gatay
• Code-Troopers
• Packt
• Polytech’Tours
• github.com/CedricGatay
• @Cedric_Gatay
2
Cedric Gatay - [email protected]
Qui a changé ce fichier ?Parce que je tiens réellement à le féliciter…
Cedric Gatay - [email protected]
Gestion de versions
• Travailler à plusieurs
• Consulter l’historique
• Résoudre les conflits
4
Cedric Gatay - [email protected]
Concepts
• Repository
• endroit où les fichiers sont stockés
• local / distant
• contient tout
5
Cedric Gatay - [email protected]
Problématique
• 10 développeurs
• 3 fonctionnalités en parallèle
• 1 bug client par semaine
10
Cedric Gatay - [email protected]
Organisation
• Branches
• dev, feature1, feature2, feature3, stable
• Chacun travaille sur une branche
11
Cedric Gatay - [email protected]
One tool to rule’em allPas tout à fait en fait…
Cedric Gatay - [email protected]
Version Control System
• Client / Serveur
• Concurrent Version System
13
Cedric Gatay - [email protected]
Version Control System
• Client / Serveur
• Concurrent Version System
• SubVersioN
13
Cedric Gatay - [email protected]
Git est un système de gestion de versions réparti Open source
rien que ça…
16
Cedric Gatay - [email protected]
Réparti
• Commit
• Consulter l’historique
• Changer de branche
• Merge
• Hors ligne !
18
Cedric Gatay - [email protected]
Open Source
• 2005 par Linus Torvalds
• Kernel Linux
• Philosophie Unix dans la conception
• .git
20
Cedric Gatay - [email protected]
Atouts
• N’enregistre pas les différences
• Rapide
• Intelligent
• Convient pour tout projet
21
Cedric Gatay - [email protected]
Cedric Gatay - [email protected]
Github
• A popularisé Git
• Réseau social de développeurs
• Coeur de beaucoup de projets OSS
23
Cedric Gatay - [email protected]
En pratiqueEt pas seulement pour les développeurs…
Cedric Gatay - [email protected]
Configuration
26
$ git config --global user.name "Cedric Gatay"$ git config --global user.email [email protected]
Cedric Gatay - [email protected]
Configuration
26
$ git config --global user.name "Cedric Gatay"$ git config --global user.email [email protected]$ cat ~/.gitconfig
Cedric Gatay - [email protected]
Configuration
26
$ git config --global user.name "Cedric Gatay"$ git config --global user.email [email protected]$ cat ~/.gitconfig[user] email = [email protected] name = Cedric Gatay
Cedric Gatay - [email protected]
Premier essai
27
$ git init$ echo "git ftw" > 1337.txt$ git add 1337.txt
Cedric Gatay - [email protected]
Premier essai
27
$ git init$ echo "git ftw" > 1337.txt$ git add 1337.txt$ git commit -m"Mon premier commit"
Cedric Gatay - [email protected]
Premier essai
28
$ git log$ git status$ git diff$ git blame 1337.txt
Cedric Gatay - [email protected]
Et les branches ?
29
$ git branch bug1$ git checkout bug1$ echo "Git FTW" > 1337.txt
Cedric Gatay - [email protected]
Et les branches ?
29
$ git branch bug1$ git checkout bug1$ echo "Git FTW" > 1337.txt$ git commit -m"Correction message"
Cedric Gatay - [email protected]
Et les branches ?
29
$ git branch bug1$ git checkout bug1$ echo "Git FTW" > 1337.txt$ git commit -m"Correction message"$ git checkout master
Cedric Gatay - [email protected]
Et les branches ?
29
$ git branch bug1$ git checkout bug1$ echo "Git FTW" > 1337.txt$ git commit -m"Correction message"$ git checkout master$ git merge bug1
Cedric Gatay - [email protected]
Synchronisation
• Plusieurs serveurs possibles
• Protocoles existants
file://, ssh://, git://, http://
32
Cedric Gatay - [email protected]
Avec Github
$ # Création d’un repository sur github.com # $ git clone [email protected]:user/repo.git $ # work.work..work... # $ git pull $ git push
34
Cedric Gatay - [email protected]
GUI
• Visuel pour l’apprentissage
• Peut simplifier l’utilisation
35
Cedric Gatay - [email protected]
Cedric Gatay - [email protected]
Cedric Gatay - [email protected]
Et moi ?
• Serveur d’entreprise SVN ?
• aucun problème
• git-svn mapping bidirectionnel
38
Cedric Gatay - [email protected]
Git-SVN
$ git svn clone -s http://mon.svn.tld$ git svn update$ git svn dcommit
39
Cedric Gatay - [email protected]
Autres utilisations
• Livres : Gitbook.io
• Wiki : Gollum
• Mise en production : Heroku
40
Cedric Gatay - [email protected]
Credits
• https://www.flickr.com/photos/dk_spook/2421009077/sizes/o
• https://www.flickr.com/photos/dunechaser/2936382027/sizes/o
• https://www.flickr.com/photos/tykva/4014209498/sizes/o
• https://www.flickr.com/photos/st3f4n/4360212268/sizes/o/
• Trademarks belong to their respective owners
42