SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
#DevoxxFR
T'es plutôt git merge ou
git rebase ?
Jean Detoeuf
@thebignet
1
#DevoxxFR
Jean Detoeuf
Développeur freelance
Software Crafter
DDD
Agile
git
2
#DevoxxFR 3
#DevoxxFR 4
Développeur apprenant git
#DevoxxFR
git log
5
#DevoxxFR 6
Deux manières de faire un merge
#DevoxxFR 7
#DevoxxFR 8
Merge
#DevoxxFR 9
merged feature A
feature A
Merge
master
#DevoxxFR
Quand faire un merge-commit ?
• Sur les branches durables
• Pour indiquer un fait marquant :
• Release, Sprint
• Mise en production
10
#DevoxxFR 11
feature A
master
Rebase
#DevoxxFR 12
master
feature A
Rebase
#DevoxxFR 13
master
feature A
Rebase
#DevoxxFR 14
master
feature A
Rebase
#DevoxxFR
Quand faire un rebase ?
• Sur acceptation d'une pull request de feature, suivi d'un merge
fast-forward
• Lors d'un git pull
15
git config --global branch.autoSetupRebase always
git config --global pull.rebase = preserve
#DevoxxFR
conflits
16
#DevoxxFR
Eviter les conflits
• Utiliser des retours à la ligne
• Eviter de travailler sur les mêmes fichiers
• Structurer correctement l'application en séparant les
fonctionnalités dans des fichiers différents
• Se répartir le travail intelligemment dans l'équipe
• Commiter régulièrement
• Faire des branches qui ne durent pas longtemps
17
#DevoxxFR
Rebase/merge
• Reuse Recorded Resolution pour éviter les corrections identiques
18
git config --global rerere.enabled true
#DevoxxFR
Réécrire l'histoire - rebase intéractif
pick f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file
# Rebase 710f0f8..a5f4a0d onto 710f0f8
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
19
#DevoxxFR
Workflows
20
#DevoxxFR
Feature merge
21
#DevoxxFR
git-flow
22
#DevoxxFR
branche unique
23
#DevoxxFR
GitHub style
24
#DevoxxFR 25
La branche est-elle
terminée ?
Intégrer une branche
durable ?
git merge --no-ff
Intégrer les changements
d'une branche durable ?
L'historique a été revue ?
non oui
git merge
Est-ce une branche durable ?
oui
non
git pull --rebase=preserve
git add
git commit
non
oui
non
non
oui
git rebase -i
oui
#DevoxxFR
Merci !
@thebignet
slideshare.net/JeanDetoeuf
thebignet.github.io/talk-merge-rebase
26
Attribution 4.0 International

Contenu connexe

Similaire à Git merge-rebase

Pourquoi versionner ses githooks.pdf
Pourquoi versionner ses githooks.pdfPourquoi versionner ses githooks.pdf
Pourquoi versionner ses githooks.pdfChris Saez
 
GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...
GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...
GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...akramalidrissi1
 
Github workflow
Github workflowGithub workflow
Github workflowJim Laurie
 
Comment maitriser git et produire de beaux commits
Comment maitriser git et produire de beaux commitsComment maitriser git et produire de beaux commits
Comment maitriser git et produire de beaux commitsJulien Maitrehenry
 
Formation GIT gratuite par ippon 2014
Formation GIT gratuite par ippon 2014Formation GIT gratuite par ippon 2014
Formation GIT gratuite par ippon 2014Ippon
 
Découvrir et utiliser Git : le logiciel de gestion de versions décentralisé
Découvrir et utiliser Git : le logiciel de gestion de versions décentraliséDécouvrir et utiliser Git : le logiciel de gestion de versions décentralisé
Découvrir et utiliser Git : le logiciel de gestion de versions décentraliséECAM Brussels Engineering School
 
Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016
Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016
Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016Fabien Arcellier
 
Débuter avec Git & github
Débuter avec Git & githubDébuter avec Git & github
Débuter avec Git & githubMonoem Youneb
 
Kubernetes University - Cap sur l'orchestration
Kubernetes University - Cap sur l'orchestrationKubernetes University - Cap sur l'orchestration
Kubernetes University - Cap sur l'orchestrationWescale
 
Kubernetes University, Cap sur l’orchestration Docker
Kubernetes University, Cap sur l’orchestration DockerKubernetes University, Cap sur l’orchestration Docker
Kubernetes University, Cap sur l’orchestration DockerJean-Baptiste Claramonte
 
Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !
Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !
Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !Publicis Sapient Engineering
 

Similaire à Git merge-rebase (20)

Tutorial Git
Tutorial GitTutorial Git
Tutorial Git
 
Pourquoi versionner ses githooks.pdf
Pourquoi versionner ses githooks.pdfPourquoi versionner ses githooks.pdf
Pourquoi versionner ses githooks.pdf
 
GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...
GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...
GIT & Future Branching-0d86ea39-71ad-4a19-940c-c10be7c33b08-9feea918-d69a-47e...
 
Github workflow
Github workflowGithub workflow
Github workflow
 
Git pratique
Git pratiqueGit pratique
Git pratique
 
Git pratique
Git pratiqueGit pratique
Git pratique
 
Comment maitriser git et produire de beaux commits
Comment maitriser git et produire de beaux commitsComment maitriser git et produire de beaux commits
Comment maitriser git et produire de beaux commits
 
Formation GIT gratuite par ippon 2014
Formation GIT gratuite par ippon 2014Formation GIT gratuite par ippon 2014
Formation GIT gratuite par ippon 2014
 
Découvrir et utiliser Git : le logiciel de gestion de versions décentralisé
Découvrir et utiliser Git : le logiciel de gestion de versions décentraliséDécouvrir et utiliser Git : le logiciel de gestion de versions décentralisé
Découvrir et utiliser Git : le logiciel de gestion de versions décentralisé
 
3_SCM_Git.pdf
3_SCM_Git.pdf3_SCM_Git.pdf
3_SCM_Git.pdf
 
Git flow
Git flowGit flow
Git flow
 
Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016
Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016
Infra as Code, choisissez vous la pilule rouge ou la pilule bleue - Devoxx 2016
 
Débuter avec Git & github
Débuter avec Git & githubDébuter avec Git & github
Débuter avec Git & github
 
Introduction à git
Introduction à gitIntroduction à git
Introduction à git
 
Compte rendu Blend Web Mix 2015
Compte rendu Blend Web Mix 2015Compte rendu Blend Web Mix 2015
Compte rendu Blend Web Mix 2015
 
Kubernetes University - Cap sur l'orchestration
Kubernetes University - Cap sur l'orchestrationKubernetes University - Cap sur l'orchestration
Kubernetes University - Cap sur l'orchestration
 
Kubernetes University, Cap sur l’orchestration Docker
Kubernetes University, Cap sur l’orchestration DockerKubernetes University, Cap sur l’orchestration Docker
Kubernetes University, Cap sur l’orchestration Docker
 
Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !
Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !
Devoxx France : Kubernetes University, Cap sur l’orchestration Docker !
 
GitPourLaNulle
GitPourLaNulleGitPourLaNulle
GitPourLaNulle
 
Jenkins Workflow
Jenkins WorkflowJenkins Workflow
Jenkins Workflow
 

Git merge-rebase