SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
   
Modern Source and
Version Control with Git
November 2016
Christian Couder
chriscool@tuxfamily.org
   
A Distributed Version Control System (DVCS):
● created by Linus Torvalds
● maintained by Junio Hamano
● since 2005
● Most popular VCS (~30% of developers)
About Git
   
● started developing Git in 2006
● worked especially on git bisect
● independent consultant working for Booking.com, 
GitLab and Protocol Labs
About myself
   
● Evolution of version control with Git
● Benefits in terms of quality and agility 
The plan
   
Easy to create and merge branches
● Before Git, branches were something “big”, slow 
and difficult to merge
● With Git, they are light and trivial
What is modern version control?
   
Why it changes everything?
● We want to create and merge many branches
● And we want to manage and automate the process
● This means we need:
– Feature branches
– Pull requests
– Complex workflows (like Git Flow)
   
Git Flow
   
Two possible reactions
● That's awesome and very smart!
● Help! I am scared, it's just too complex and 
unmanageable!
   
Let's keep history simple (stupid)!
We need something to linearize history!
=> git rebase is our friend
While at it, let's also merge or move or just remove 
commits!
=> git rebase ­i is our friend
   
Let's go with a complex history!
● git log ­­decorate ­­oneline –graph
will help visualize it!
● git bisect will help find bad commits
– We can even automate it with: git bisect run
– We can skip untestable commits with:
git bisect skip
   
Commits in Git form a DAG
(Directed Acyclic Graph)
●
history direction is from left to right
●
new commits point to their parents
   
First Bad Commit
B
●
B introduces a bad behavior called "bug" or "regression"
●
red commits are called "bad"
●
blue commits are called "good"
   
In the end it all comes together
● When using git rebase and git bisect we realize that 
they work together very well 
● Let's take a look for example at code review and 
testing
   
Why Code Review and Testing?
● They are the best way to improve: quality and agility
● Continuous Integration and Deployment rely on 
Code Review and Testing
Because you really don't want bugs in the product 
you give to your customer!
   
Modern Code Review 1
● It's when you “polish” (rework) your commits until it is 
clear that they are all good.
● This means you want:
– small commits
– good commit messages (that explain why)
   
Modern Code Review 2
git rebase ­i helps you rework commits:
● split them into smaller commits
● modify them and their commit message
   
Modern Testing
● Think black box test too, not just unit tests
● Test each commit: git rebase ­­exec <cmd>
● 1 test at least for each new feature
● 1 test at least for each bug (fixed, or not)
   
● 11 years ago Junio Hamano created the Git test 
framework (test­lib.sh)
● Developed in shell (POSIX /bin/sh compatible)
● Extracted 5 years ago by Mathias Lafeldt into a 
separate project called Sharness
● It's one of the main reasons why Git has always 
been very stable
Sharness
   
Why 1 test for each new feature?
● It shows the feature has been at least minimally 
tested
● It documents the feature
● It makes the reviewer's job easier
● It makes it easier to add more tests later
   
Why 1 test for each bug (fixed, or not)?
● It documents the bug
● It helps reproduce the bug
● It will make sure the bug will not reappear
● It makes the reviewer's job easier
● It's easy to do if there is already 1 test per feature
   
Using a git bisect based Test Workflow
● Write the test for a bug before fixing the bug
● Use git bisect run mytest to automatically find the 
commit that introduced the bug  
● Fix the bug (which should be easier)
● Commit the bug fix and the test together
   
Why a git bisect based test workflow?
● It make it easier to fix the bug
● Because it gives more accurate information
● It takes advantage of small commits
● It takes advantage of good commit messages
● People who have used it report great efficiency 
improvements
   
To conclude
Hopefully you now know what can be a modern 
version control with Git, especially:
● The evolution it represents, and the logic of this 
evolution 
● The benefits, in terms of quality and agility, through 
better code reviews and testing
   
Many thanks to:
● Junio Hamano, Linus Torvalds, Mathias Lafeldt
● many other great people in the Git and Linux communities
● Paris Open Source Summit organizers and attendants,
● Booking.com, GitLab and Protocol Labs, the companies I am working 
for.
   
● http://www.slideshare.net/ChristianCouder/
● https://semmle.com/customers/github­change­impact/
● http://git­scm.com
● https://github.com/chriscool/sharness
● https://github.com/chriscool/sharnessify
Links
   
Questions?
   
Idea:
● help find a first bad commit
● use a binary search algorithm for efficiency if 
possible
 
Benefits:
● manually verifying the source code changes 
from only one commit is relatively easy
● the commit gives extra information: commit 
message, author, ... 
Git bisect

Weitere ähnliche Inhalte

Was ist angesagt?

Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using GitYan Vugenfirer
 
GIT - DUG Antwerp
GIT - DUG AntwerpGIT - DUG Antwerp
GIT - DUG AntwerpKrimson
 
Khorshed presentation-digital world2016
Khorshed presentation-digital world2016Khorshed presentation-digital world2016
Khorshed presentation-digital world2016Khorshed Alam
 
Helios in Action: Git at Eclipse
Helios in Action: Git at EclipseHelios in Action: Git at Eclipse
Helios in Action: Git at EclipseChris Aniszczyk
 
Der Freitag, A Use Case
Der Freitag, A Use CaseDer Freitag, A Use Case
Der Freitag, A Use Casekhink
 
Git tech talk
Git tech talkGit tech talk
Git tech talkrazasayed
 
Corwin on containers
Corwin on containersCorwin on containers
Corwin on containersCorwin Brown
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitColin Su
 
Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010alanburke
 
Workshop on Source control, git merge walkthroughs
Workshop on Source control, git merge walkthroughsWorkshop on Source control, git merge walkthroughs
Workshop on Source control, git merge walkthroughsDavid Lawrence
 
Version open source everything
Version   open source everythingVersion   open source everything
Version open source everythingBaylee Schmeisser
 

Was ist angesagt? (20)

Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
 
Git: Git'ing the Basic
Git: Git'ing the BasicGit: Git'ing the Basic
Git: Git'ing the Basic
 
SCM Boot Camp
SCM Boot CampSCM Boot Camp
SCM Boot Camp
 
Git 1
Git 1Git 1
Git 1
 
Git
GitGit
Git
 
Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
GIT - DUG Antwerp
GIT - DUG AntwerpGIT - DUG Antwerp
GIT - DUG Antwerp
 
Git training with Devaamo
Git training with DevaamoGit training with Devaamo
Git training with Devaamo
 
Khorshed presentation-digital world2016
Khorshed presentation-digital world2016Khorshed presentation-digital world2016
Khorshed presentation-digital world2016
 
Go in Production
Go in ProductionGo in Production
Go in Production
 
Helios in Action: Git at Eclipse
Helios in Action: Git at EclipseHelios in Action: Git at Eclipse
Helios in Action: Git at Eclipse
 
Der Freitag, A Use Case
Der Freitag, A Use CaseDer Freitag, A Use Case
Der Freitag, A Use Case
 
Git tech talk
Git tech talkGit tech talk
Git tech talk
 
Corwin on containers
Corwin on containersCorwin on containers
Corwin on containers
 
Git advanced
Git advancedGit advanced
Git advanced
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010Git - Drupalcamp Ireland Dublin 2010
Git - Drupalcamp Ireland Dublin 2010
 
Open source
Open sourceOpen source
Open source
 
Workshop on Source control, git merge walkthroughs
Workshop on Source control, git merge walkthroughsWorkshop on Source control, git merge walkthroughs
Workshop on Source control, git merge walkthroughs
 
Version open source everything
Version   open source everythingVersion   open source everything
Version open source everything
 

Ähnlich wie Modern source and_version_control_with_git

Git Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, ScalableGit Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, Scalablepieterh
 
Introduction to git and stash
Introduction to git and stashIntroduction to git and stash
Introduction to git and stashXpand IT
 
Harvard ABCD-WWW Git presentation
Harvard ABCD-WWW Git presentationHarvard ABCD-WWW Git presentation
Harvard ABCD-WWW Git presentationJeff Byrnes
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.WordCamp Harare
 
Managing e commerce systems codebase with git
Managing e commerce systems codebase with gitManaging e commerce systems codebase with git
Managing e commerce systems codebase with gitBruno Ricardo Siqueira
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flowKnoldus Inc.
 
Beginner walkthrough to git and github
Beginner walkthrough to git and githubBeginner walkthrough to git and github
Beginner walkthrough to git and githubMahmoud Said
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflowsArthur Shvetsov
 
Git(hub) for windows developers
Git(hub) for windows developersGit(hub) for windows developers
Git(hub) for windows developersbwullems
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git聖文 鄭
 

Ähnlich wie Modern source and_version_control_with_git (20)

Git Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, ScalableGit Without Branches - Simple, Smooth, Scalable
Git Without Branches - Simple, Smooth, Scalable
 
Git flow
Git flowGit flow
Git flow
 
Introduction to git and stash
Introduction to git and stashIntroduction to git and stash
Introduction to git and stash
 
Harvard ABCD-WWW Git presentation
Harvard ABCD-WWW Git presentationHarvard ABCD-WWW Git presentation
Harvard ABCD-WWW Git presentation
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
 
Managing e commerce systems codebase with git
Managing e commerce systems codebase with gitManaging e commerce systems codebase with git
Managing e commerce systems codebase with git
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flow
 
3 Git
3 Git3 Git
3 Git
 
Beginner walkthrough to git and github
Beginner walkthrough to git and githubBeginner walkthrough to git and github
Beginner walkthrough to git and github
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git(hub) for windows developers
Git(hub) for windows developersGit(hub) for windows developers
Git(hub) for windows developers
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git SVN Migrate Reasons
Git SVN Migrate ReasonsGit SVN Migrate Reasons
Git SVN Migrate Reasons
 
Git introduction
Git introductionGit introduction
Git introduction
 
Version Controlling With Git
Version Controlling With GitVersion Controlling With Git
Version Controlling With Git
 
Git Introduction
Git IntroductionGit Introduction
Git Introduction
 
Gitting better
Gitting betterGitting better
Gitting better
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
 

Kürzlich hochgeladen

SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 

Kürzlich hochgeladen (20)

SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 

Modern source and_version_control_with_git