Contenu connexe
Similaire à Brown Bag Lunch Tours @ CEFIM - Git pour tous (20)
Brown Bag Lunch Tours @ CEFIM - Git pour tous
- 1. Cedric Gatay - c.gatay@code-troopers.com1
Git pour tous
vraiment tous…
- 2. Cedric Gatay - c.gatay@code-troopers.com
Cedric Gatay
• Code-Troopers
• Packt
• Polytech’Tours
• github.com/CedricGatay
• @Cedric_Gatay
2
- 3. Cedric Gatay - c.gatay@code-troopers.com3
Qui a changé ce fichier ?
Parce que je tiens réellement à le féliciter…
- 4. Cedric Gatay - c.gatay@code-troopers.com
Gestion de versions
• Travailler à plusieurs
• Consulter l’historique
• Résoudre les conflits
4
- 5. Cedric Gatay - c.gatay@code-troopers.com
Concepts
• Repository
• endroit où les fichiers sont stockés
• local / distant
• contient tout
5
- 6. Cedric Gatay - c.gatay@code-troopers.com
Concepts
• Commit
• opération sur le repository
6
- 7. Cedric Gatay - c.gatay@code-troopers.com
Concepts
• Branch
• ligne de développement
7
- 8. Cedric Gatay - c.gatay@code-troopers.com
Concepts
• Merge
• point de jonction entre commits /
branches
8
- 9. Cedric Gatay - c.gatay@code-troopers.com
Concepts
• Tag
• nom associé à un commit
9
- 10. Cedric Gatay - c.gatay@code-troopers.com
Problématique
• 10 développeurs
• 3 fonctionnalités en parallèle
• 1 bug client par semaine
10
- 11. Cedric Gatay - c.gatay@code-troopers.com
Organisation
• Branches
• dev, feature1, feature2, feature3, stable
• Chacun travaille sur une branche
11
- 12. Cedric Gatay - c.gatay@code-troopers.com12
One tool to rule’em all
Pas tout à fait en fait…
- 13. Cedric Gatay - c.gatay@code-troopers.com
Version Control System
• Client / Serveur
13
- 14. Cedric Gatay - c.gatay@code-troopers.com
Version Control System
• Client / Serveur
• ConcurrentVersion System
13
- 15. Cedric Gatay - c.gatay@code-troopers.com
Version Control System
• Client / Serveur
• ConcurrentVersion System
• SubVersioN
13
- 16. Cedric Gatay - c.gatay@code-troopers.com
DecentralizedVCS
• Chaque noeud possède tout
• Peer to peer
14
- 17. Cedric Gatay - c.gatay@code-troopers.com
DVCS
• Bazaar
• Mercurial
• Git
15
- 18. Cedric Gatay - c.gatay@code-troopers.com
Git est un système de gestion de
versions réparti Open source
rien que ça…
16
- 19. Cedric Gatay - c.gatay@code-troopers.com
Git est un système de gestion de
versions réparti Open source
17
- 20. Cedric Gatay - c.gatay@code-troopers.com
Réparti
• Commit
• Consulter l’historique
• Changer de branche
• Merge
• Hors ligne !
18
- 21. Cedric Gatay - c.gatay@code-troopers.com
Git est un système de gestion de
versions réparti Open source
19
- 22. Cedric Gatay - c.gatay@code-troopers.com
Open Source
• 2005 par Linus Torvalds
• Kernel Linux
• Philosophie Unix dans la conception
• .git
20
- 23. Cedric Gatay - c.gatay@code-troopers.com
Atouts
• N’enregistre pas les différences
• Rapide
• Intelligent
• Convient pour tout projet
21
- 25. Cedric Gatay - c.gatay@code-troopers.com
Github
• A popularisé Git
• Réseau social de développeurs
• Coeur de beaucoup de projets OSS
23
- 26. Cedric Gatay - c.gatay@code-troopers.com24
En pratique
Et pas seulement pour les développeurs…
- 27. Cedric Gatay - c.gatay@code-troopers.com
Installation
• Gestionnaire de paquets
• http://git-scm.com
25
- 28. Cedric Gatay - c.gatay@code-troopers.com
Configuration
26
$ git config --global user.name "Cedric Gatay"
- 29. Cedric Gatay - c.gatay@code-troopers.com
Configuration
26
$ git config --global user.name "Cedric Gatay"
$ git config --global user.email c.gatay@dmn.tld
- 30. Cedric Gatay - c.gatay@code-troopers.com
Configuration
26
$ git config --global user.name "Cedric Gatay"
$ git config --global user.email c.gatay@dmn.tld
$ cat ~/.gitconfig
- 31. Cedric Gatay - c.gatay@code-troopers.com
Configuration
26
$ git config --global user.name "Cedric Gatay"
$ git config --global user.email c.gatay@dmn.tld
$ cat ~/.gitconfig
[user]
email = c.gatay@dmn.tld
name = Cedric Gatay
- 32. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
27
$ git init
- 33. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
27
$ git init
$ echo "git ftw" > 1337.txt
- 34. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
27
$ git init
$ echo "git ftw" > 1337.txt
$ git add 1337.txt
- 35. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
27
$ git init
$ echo "git ftw" > 1337.txt
$ git add 1337.txt
$ git commit -m"Mon premier commit"
- 36. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
28
$ git log
- 37. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
28
$ git log
$ git status
- 38. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
28
$ git log
$ git status
$ git diff
- 39. Cedric Gatay - c.gatay@code-troopers.com
Premier essai
28
$ git log
$ git status
$ git diff
$ git blame 1337.txt
- 40. Cedric Gatay - c.gatay@code-troopers.com
Et les branches ?
29
$ git branch bug1
- 41. Cedric Gatay - c.gatay@code-troopers.com
Et les branches ?
29
$ git branch bug1
$ git checkout bug1
- 42. Cedric Gatay - c.gatay@code-troopers.com
Et les branches ?
29
$ git branch bug1
$ git checkout bug1
$ echo "Git FTW" > 1337.txt
- 43. Cedric Gatay - c.gatay@code-troopers.com
Et les branches ?
29
$ git branch bug1
$ git checkout bug1
$ echo "Git FTW" > 1337.txt
$ git commit -m"Correction message"
- 44. Cedric Gatay - c.gatay@code-troopers.com
Et les branches ?
29
$ git branch bug1
$ git checkout bug1
$ echo "Git FTW" > 1337.txt
$ git commit -m"Correction message"
$ git checkout master
- 45. Cedric Gatay - c.gatay@code-troopers.com
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
- 47. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
30
C1
master
- 48. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
30
C1
branch
master
bug1
- 49. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
30
C1 C2
master
bug1
- 50. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
30
C1 C2
merge
master
bug1
- 51. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
31
C1
master
bug1
- 52. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
31
C1
C2
master
bug1
- 53. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
31
C1 C3
C2
master
bug1
- 54. Cedric Gatay - c.gatay@code-troopers.com
Visuellement
31
C1 C3
C2
C4
master
bug1
- 55. Cedric Gatay - c.gatay@code-troopers.com
Synchronisation
• Plusieurs serveurs possibles
• Protocoles existants
file://, ssh://, git://, http://
32
- 56. Cedric Gatay - c.gatay@code-troopers.com
Synchronisation
33
$ git fetch
- 57. Cedric Gatay - c.gatay@code-troopers.com
Synchronisation
33
$ git fetch
$ git push
- 58. Cedric Gatay - c.gatay@code-troopers.com
Synchronisation
33
$ git fetch
$ git push
$ git pull
- 59. Cedric Gatay - c.gatay@code-troopers.com
Avec Github
$ # Création d’un repository sur github.com #
$ git clone git@github.com:user/repo.git
$ # work.work..work... #
$ git pull
$ git push
34
- 60. Cedric Gatay - c.gatay@code-troopers.com
GUI
• Visuel pour l’apprentissage
• Peut simplifier l’utilisation
35
- 63. Cedric Gatay - c.gatay@code-troopers.com
Et moi ?
• Serveur d’entreprise SVN ?
• aucun problème
• git-svn mapping bidirectionnel
38
- 64. Cedric Gatay - c.gatay@code-troopers.com
Git-SVN
$ git svn clone -s http://mon.svn.tld
39
- 65. Cedric Gatay - c.gatay@code-troopers.com
Git-SVN
$ git svn clone -s http://mon.svn.tld
$ git svn update
39
- 66. Cedric Gatay - c.gatay@code-troopers.com
Git-SVN
$ git svn clone -s http://mon.svn.tld
$ git svn update
$ git svn dcommit
39
- 67. Cedric Gatay - c.gatay@code-troopers.com
Autres utilisations
• Livres : Gitbook.io
• Wiki : Gollum
• Mise en production : Heroku
40
- 69. Cedric Gatay - c.gatay@code-troopers.com
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