SlideShare una empresa de Scribd logo
1 de 32
Conflicting Advice on
Alternative Git Usage Patterns
& Their Implications
SSSG, Nov. 25th, 2013
YoungSeok Yoon
(youngseok@cs.cmu.edu)
Git
• Distributed version control system (DVCS)
• Developed by Linus Torvalds in 2005

• Supports parallel development very well with
branches
• Very popular among software developers
2
PRIMARY CODE MANAGEMENT
What is the primary source code management system you
typically use? (Choose one.)
37.8%
46.0%
51.3%
58.3%

Subversion
Git
GitHub
CVS
Mercurial

30.3%
23.2%
12.8%
6.8%
6.0%
4.4%

4.5%
8.9%
13.3%
12.6%
3.6%
2.6%
4.6%
3.0%

IBM Rational ClearCase

2.2%
2.3%
2.7%
2.8%

IBM Rational Team Concert

2013
2012
2011
2010

1.4%
2.2%
0.6%
0.9%

Eclipse Open Source Developer Report 2013

3

 Subversion continue to decrease to only 37.8%
 Git and GitHub combined represent 36.3%
Centralized Model (e.g., SVN)

Image: http://git-scm.com/book/en/Getting-Started-About-Version-Control

4
Distributed Model
(e.g., Git, Mercurial)

Image: http://git-scm.com/book/en/Getting-Started-About-Version-Control

5
My Git Experience
• Had been a Mercurial user for 3 years
• Switched to Git 2 months ago

6
Typical Git Workflow
• Single main development branch
– Usually the ‘master’ branch

• Use of topic (or feature) branches
– Create a topic branch off of master
– Make commits on the topic branch
– Merge the topic branch into master when finished
– Delete the topic branch
7
Topic Branch Illustrated

Screenshots taken with Atlassian’s SourceTree

8
Topic Branch Illustrated

9
Topic Branch Illustrated

10
Topic Branch Illustrated

11
Topic Branch Illustrated

12
Topic Branch Illustrated

13
Topic Branch Illustrated

14
Topic Branch Illustrated

15
1. Merge or Rebase?
• The topic branch is ready to be merged
• What if there were other commits made on ‘master’
while working on the topic branch?

16
Merging and Rebasing Illustrated
Plain Merge

Rebase

then Merge

17
Merging
• Bringing two branches together,
while preserving the commit
history of each branch
• Pros
– Natural and intuitive
– Shows the exact context in which the feature was implemented
– Better to handle merge conflicts

• Cons
– History can be very hard to read, when there are a lot of developers working
in parallel in their own topic branches, and they are merged back to master

18
An Extremely Complex Merge Tree

Image: http://blog.sourcetreeapp.com/2012/08/21/merge-or-rebase/

19
Rebasing
• Rewriting the commits from
the source branch onto the
head commit of the
destination branch
• Pros
– Much cleaner, easier to read history (i.e., no complex merge graph)

• Cons
– Possible to mess up the history in a team setting
– Does not handle merge conflicts very well
– The changes are put in a different context, which can have unexpected
side effects
– Losing the history of what actually happened

20
Example of Rebase-Then-Merge
based History

21
Another Situation
• Keeping the topic branch up to date
– by merging

– by rebasing

22
Merging vs. Rebasing:
Which One to Choose?
• In some situations, merging is the only option
– when the topic branch is publicized
– when there are merge conflicts

• Otherwise, it depends on what the team or
individual values the most
– trade-off between traceability and cleaner history

23
2. Fast-Forward Merge or Not?
• Before merging a topic branch into master,
suppose there are no other changes on master

• Git, by default, performs a ‘fast-forward merge’ in
this case

24
Fast-Forward Merge Illustrated
fast-forward merge

no-ff merge

Image: https://www.atlassian.com/git/tutorial/git-branches#!merge

25
Fast-Forward Merge vs. No-FF Merge
fast-forward merge

no-ff merge

• Cleaner looking SVN-like
linear history

• Keeps the history of what
exactly happened

• Makes sense for relatively
small, short-lived branches

• The topic branch commits
are clearly grouped visually

• Work better with other git
commands (i.e., git bisect)

• Easy to revert the entire
branch later
26
3. Selective Commit or Not?
• Git has a staging area (or index), which is an additional layer
between the git database and the working copy

Image: http://azuwis.github.io/git/#/step-13

27
Selective Commit
• Code changes in the working copy can be
selectively committed using the staging area
• This is useful in many situations, but can also
be dangerous
– the staged changes may not be tested, and may
even break the build when committed
(which I have already done several times)
28
Should Selective Commit Be Allowed?
• Fortunately, there is a way of achieving both goals at
the same time
• ‘git stash --keep-index’ to temporarily set aside the
local changes that are not added to the staging area
– the changes in the staging area can now be tested directly
– adds more work, but a lot safer than blindly committing

29
Difficulties of Mining Git Repositories
• The inherent graph-based history
• Branch names are not very well preserved
• History rewriting commands makes it difficult to
discover what exactly happened at a given time
– rebase is one of the many ways of rewriting history

• More detailed explanation can be found in
[Bird+ MSR 09]
Bird, Christian, et al. "The promises and perils of mining git.”
Mining Software Repositories, 2009. MSR'09

30
Conclusion
• Mixed feelings towards Git:
– powerful enough that I have full control of how
the commit history would look like
– extremely difficult to learn

– very easy to misuse commands and break things
31
Questions?

“With great power,
comes great responsibility”

32

Más contenido relacionado

La actualidad más candente

A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to gitEmanuele Olivetti
 
Git the fast version control system
Git the fast version control systemGit the fast version control system
Git the fast version control systemJeroen Rosenberg
 
Advanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesAdvanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesBrent Laster
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction TutorialThomas Rausch
 
Version control and GIT Primer
Version control and GIT PrimerVersion control and GIT Primer
Version control and GIT Primersaadulde
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with GitLuigi De Russis
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagramsDilum Navanjana
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administrationShawn Doyle
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...SlideTeam
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-itAutomat-IT
 

La actualidad más candente (20)

01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Git the fast version control system
Git the fast version control systemGit the fast version control system
Git the fast version control system
 
GIT In Detail
GIT In DetailGIT In Detail
GIT In Detail
 
Advanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesAdvanced Git: Functionality and Features
Advanced Git: Functionality and Features
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Version control and GIT Primer
Version control and GIT PrimerVersion control and GIT Primer
Version control and GIT Primer
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Introduction to Git (part 2)
Introduction to Git (part 2)Introduction to Git (part 2)
Introduction to Git (part 2)
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git training
Git trainingGit training
Git training
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
Git vs. Mercurial
Git vs. MercurialGit vs. Mercurial
Git vs. Mercurial
 

Similar a Conflicting Advice on Git Usage Patterns & Their Implications

Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | EdurekaEdureka!
 
Using Git with Rational Team Concert and Rational ClearCase in enterprise env...
Using Git with Rational Team Concert and Rational ClearCase in enterprise env...Using Git with Rational Team Concert and Rational ClearCase in enterprise env...
Using Git with Rational Team Concert and Rational ClearCase in enterprise env...Bartosz Chrabski
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenchesNuno Caneco
 
Why retail companies can't afford database downtime
Why retail companies can't afford database downtimeWhy retail companies can't afford database downtime
Why retail companies can't afford database downtimeDBmaestro - Database DevOps
 
Contemporary source control for pharo
Contemporary source control for pharoContemporary source control for pharo
Contemporary source control for pharoESUG
 
Qardio experience with Core Data
Qardio experience with Core DataQardio experience with Core Data
Qardio experience with Core DataDmitrii Ivanov
 
Svn vs mercurial vs github
Svn  vs  mercurial vs  githubSvn  vs  mercurial vs  github
Svn vs mercurial vs githubVinoth Kannan
 
BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)Drupal Portugal
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)Yeasin Abedin
 
Version Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part IVersion Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part ISergey Aganezov
 
[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with GitIvano Malavolta
 
An introduction to Git and GitFlow
An introduction to Git and GitFlowAn introduction to Git and GitFlow
An introduction to Git and GitFlowMark Everard
 

Similar a Conflicting Advice on Git Usage Patterns & Their Implications (20)

Git interview questions | Edureka
Git interview questions | EdurekaGit interview questions | Edureka
Git interview questions | Edureka
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Using Git with Rational Team Concert and Rational ClearCase in enterprise env...
Using Git with Rational Team Concert and Rational ClearCase in enterprise env...Using Git with Rational Team Concert and Rational ClearCase in enterprise env...
Using Git with Rational Team Concert and Rational ClearCase in enterprise env...
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
GIT INTRODUCTION
GIT INTRODUCTIONGIT INTRODUCTION
GIT INTRODUCTION
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
 
Why retail companies can't afford database downtime
Why retail companies can't afford database downtimeWhy retail companies can't afford database downtime
Why retail companies can't afford database downtime
 
Contemporary source control for pharo
Contemporary source control for pharoContemporary source control for pharo
Contemporary source control for pharo
 
Qardio experience with Core Data
Qardio experience with Core DataQardio experience with Core Data
Qardio experience with Core Data
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Svn vs mercurial vs github
Svn  vs  mercurial vs  githubSvn  vs  mercurial vs  github
Svn vs mercurial vs github
 
BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)
 
IntroductionGit
IntroductionGitIntroductionGit
IntroductionGit
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
 
Version Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part IVersion Control Systems -- Git -- Part I
Version Control Systems -- Git -- Part I
 
[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git[2015/2016] Collaborative software development with Git
[2015/2016] Collaborative software development with Git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git
GitGit
Git
 
An introduction to Git and GitFlow
An introduction to Git and GitFlowAn introduction to Git and GitFlow
An introduction to Git and GitFlow
 
Git version control
Git version controlGit version control
Git version control
 

Último

Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceTina Ji
 
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleBiswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleQui9 (Ultimate Quizzing)
 
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Sonam Pathan
 
GRADE 7 NEW PPT ENGLISH 1 [Autosaved].pp
GRADE 7 NEW PPT ENGLISH 1 [Autosaved].ppGRADE 7 NEW PPT ENGLISH 1 [Autosaved].pp
GRADE 7 NEW PPT ENGLISH 1 [Autosaved].ppJasmineLinogon
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Documentf4ssvxpz62
 
Gripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to MissGripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to Missget joys
 
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...Amil Baba Company
 
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...Amil Baba Company
 
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一lvtagr7
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...First NO1 World Amil baba in Faisalabad
 
Statement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfileStatement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfilef4ssvxpz62
 
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzersQUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzersSJU Quizzers
 
Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...
Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...
Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...Amil Baba Company
 
NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...
NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...
NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...Amil Baba Company
 
(伦敦大学毕业证学位证成绩单-PDF版)
(伦敦大学毕业证学位证成绩单-PDF版)(伦敦大学毕业证学位证成绩单-PDF版)
(伦敦大学毕业证学位证成绩单-PDF版)twfkn8xj
 
原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证
原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证
原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证jdkhjh
 
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...Amil Baba Dawood bangali
 
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...Amil baba
 

Último (20)

Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170
 
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts ServiceCall Girls in Faridabad 9000000000 Faridabad Escorts Service
Call Girls in Faridabad 9000000000 Faridabad Escorts Service
 
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleBiswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
 
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
 
GRADE 7 NEW PPT ENGLISH 1 [Autosaved].pp
GRADE 7 NEW PPT ENGLISH 1 [Autosaved].ppGRADE 7 NEW PPT ENGLISH 1 [Autosaved].pp
GRADE 7 NEW PPT ENGLISH 1 [Autosaved].pp
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Document
 
Gripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to MissGripping Adult Web Series You Can't Afford to Miss
Gripping Adult Web Series You Can't Afford to Miss
 
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
Real NO1 Amil baba in Faisalabad Kala jadu in faisalabad Aamil baba Faisalaba...
 
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
 
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
定制(UofT毕业证书)加拿大多伦多大学毕业证成绩单原版一比一
 
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Serviceyoung call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
 
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
 
Statement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfileStatement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfile
 
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzersQUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
QUIZ BOLLYWOOD ( weekly quiz ) - SJU quizzers
 
Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...
Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...
Amil Baba In Rawalpindi Kala Jadu Expert Rawalpindi amil baba in rawalpindi j...
 
NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...
NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...
NO,1 Amil baba in Lahore Astrologer in Karachi amil baba in pakistan amil bab...
 
(伦敦大学毕业证学位证成绩单-PDF版)
(伦敦大学毕业证学位证成绩单-PDF版)(伦敦大学毕业证学位证成绩单-PDF版)
(伦敦大学毕业证学位证成绩单-PDF版)
 
原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证
原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证
原版1:1复刻帕森斯设计学院毕业证Parsons毕业证留信学历认证
 
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
 
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
 

Conflicting Advice on Git Usage Patterns & Their Implications

  • 1. Conflicting Advice on Alternative Git Usage Patterns & Their Implications SSSG, Nov. 25th, 2013 YoungSeok Yoon (youngseok@cs.cmu.edu)
  • 2. Git • Distributed version control system (DVCS) • Developed by Linus Torvalds in 2005 • Supports parallel development very well with branches • Very popular among software developers 2
  • 3. PRIMARY CODE MANAGEMENT What is the primary source code management system you typically use? (Choose one.) 37.8% 46.0% 51.3% 58.3% Subversion Git GitHub CVS Mercurial 30.3% 23.2% 12.8% 6.8% 6.0% 4.4% 4.5% 8.9% 13.3% 12.6% 3.6% 2.6% 4.6% 3.0% IBM Rational ClearCase 2.2% 2.3% 2.7% 2.8% IBM Rational Team Concert 2013 2012 2011 2010 1.4% 2.2% 0.6% 0.9% Eclipse Open Source Developer Report 2013 3  Subversion continue to decrease to only 37.8%  Git and GitHub combined represent 36.3%
  • 4. Centralized Model (e.g., SVN) Image: http://git-scm.com/book/en/Getting-Started-About-Version-Control 4
  • 5. Distributed Model (e.g., Git, Mercurial) Image: http://git-scm.com/book/en/Getting-Started-About-Version-Control 5
  • 6. My Git Experience • Had been a Mercurial user for 3 years • Switched to Git 2 months ago 6
  • 7. Typical Git Workflow • Single main development branch – Usually the ‘master’ branch • Use of topic (or feature) branches – Create a topic branch off of master – Make commits on the topic branch – Merge the topic branch into master when finished – Delete the topic branch 7
  • 8. Topic Branch Illustrated Screenshots taken with Atlassian’s SourceTree 8
  • 16. 1. Merge or Rebase? • The topic branch is ready to be merged • What if there were other commits made on ‘master’ while working on the topic branch? 16
  • 17. Merging and Rebasing Illustrated Plain Merge Rebase then Merge 17
  • 18. Merging • Bringing two branches together, while preserving the commit history of each branch • Pros – Natural and intuitive – Shows the exact context in which the feature was implemented – Better to handle merge conflicts • Cons – History can be very hard to read, when there are a lot of developers working in parallel in their own topic branches, and they are merged back to master 18
  • 19. An Extremely Complex Merge Tree Image: http://blog.sourcetreeapp.com/2012/08/21/merge-or-rebase/ 19
  • 20. Rebasing • Rewriting the commits from the source branch onto the head commit of the destination branch • Pros – Much cleaner, easier to read history (i.e., no complex merge graph) • Cons – Possible to mess up the history in a team setting – Does not handle merge conflicts very well – The changes are put in a different context, which can have unexpected side effects – Losing the history of what actually happened 20
  • 22. Another Situation • Keeping the topic branch up to date – by merging – by rebasing 22
  • 23. Merging vs. Rebasing: Which One to Choose? • In some situations, merging is the only option – when the topic branch is publicized – when there are merge conflicts • Otherwise, it depends on what the team or individual values the most – trade-off between traceability and cleaner history 23
  • 24. 2. Fast-Forward Merge or Not? • Before merging a topic branch into master, suppose there are no other changes on master • Git, by default, performs a ‘fast-forward merge’ in this case 24
  • 25. Fast-Forward Merge Illustrated fast-forward merge no-ff merge Image: https://www.atlassian.com/git/tutorial/git-branches#!merge 25
  • 26. Fast-Forward Merge vs. No-FF Merge fast-forward merge no-ff merge • Cleaner looking SVN-like linear history • Keeps the history of what exactly happened • Makes sense for relatively small, short-lived branches • The topic branch commits are clearly grouped visually • Work better with other git commands (i.e., git bisect) • Easy to revert the entire branch later 26
  • 27. 3. Selective Commit or Not? • Git has a staging area (or index), which is an additional layer between the git database and the working copy Image: http://azuwis.github.io/git/#/step-13 27
  • 28. Selective Commit • Code changes in the working copy can be selectively committed using the staging area • This is useful in many situations, but can also be dangerous – the staged changes may not be tested, and may even break the build when committed (which I have already done several times) 28
  • 29. Should Selective Commit Be Allowed? • Fortunately, there is a way of achieving both goals at the same time • ‘git stash --keep-index’ to temporarily set aside the local changes that are not added to the staging area – the changes in the staging area can now be tested directly – adds more work, but a lot safer than blindly committing 29
  • 30. Difficulties of Mining Git Repositories • The inherent graph-based history • Branch names are not very well preserved • History rewriting commands makes it difficult to discover what exactly happened at a given time – rebase is one of the many ways of rewriting history • More detailed explanation can be found in [Bird+ MSR 09] Bird, Christian, et al. "The promises and perils of mining git.” Mining Software Repositories, 2009. MSR'09 30
  • 31. Conclusion • Mixed feelings towards Git: – powerful enough that I have full control of how the commit history would look like – extremely difficult to learn – very easy to misuse commands and break things 31
  • 32. Questions? “With great power, comes great responsibility” 32

Notas del editor

  1. It’s more of a “conflicting advice on alternative git usage patterns and their implications”
  2. Introduce the words “push” and “pull”.
  3. Say that Hg can be as powerful as Git by enabling many extensions, but they should be explicitly enabled.By default, Hg only provides safe, easy to use features.As a novice Git user, I tried to learn the Git best practices, and how things are done in git-like way, by reading articles on the Internet.During that process, I came across a lot of conflicting pieces of advice on how to use Git.Throughout this talk, I’m going to share some examples of conflicting advice of using Git, and the reasons behind their thoughts.
  4. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  5. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  6. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  7. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  8. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  9. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  10. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  11. Say that it’s quite different model compared to traditional SVN model where you have very linear commit history.Why should we do that? In several words at least.
  12. parallel vs. sequential
  13. Just summarized here. (again, there is a tradeoff between these two approaches)