21
Subversion to Git: A Sugar Story John Mertic ©2012 SugarCRM Inc. All rights reserved.

The Virtual Git Summit - Subversion to Git - A Sugar Story

Embed Size (px)

DESCRIPTION

After many years of faithful use of Subversion as our version control system of choice, we found the need for something more flexible that could better scale with the many code trees we manage across our engineering organization. In this talk, I’ll talk about how using Subversion for version control wasn’t doing it for us anymore, the move to using Git and GitHub (and the challenges along the way), and the various wins we have gained as an engineering organization and with our partner and community developers.

Citation preview

Page 1: The Virtual Git Summit - Subversion to Git - A Sugar Story

Subversion to Git: A Sugar Story

John Mertic

©2012 SugarCRM Inc. All rights reserved.

Page 2: The Virtual Git Summit - Subversion to Git - A Sugar Story

Who Am I?

!   John Mertic !  Contact Info

! http://jmertic.wordpress.com

!   Twitter: @jmertic ! [email protected]

( SugarCRM ) ! [email protected] ( PHP )

!  Community Manager for SugarCRM ! http://www.sugarcrm.com ! http://www.sugarforge.org !   Twitter: @sugarcrmdev

2/1/2012

@2012 SugarCRM Inc. All rights reserved. 2

Page 3: The Virtual Git Summit - Subversion to Git - A Sugar Story

Why we started looking past Subversion

!   Merging was painful !  Couldn’t easily work on multiple releases at once !  Couldn’t do feature branch integration easily !  Merging cost us several days of downtime plus integration

testing !   No good way of doing pre-commit reviews

!   Tried using Review Board for post-commit reviewing, but was ineffective

!  Pre-commit reviews required manual posting of diff files and manual merging

!   Overall, felt Subversion could scale to match our growing team.

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 3

Page 4: The Virtual Git Summit - Subversion to Git - A Sugar Story

Why git?

!   Wanted to move towards a DVCS tool to support our growing team

!   Best quality of tools and IDE plugins across the various DVCS tools.

!   Many team members already familiar with git, which helped train other team members

! GitHub

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 4

Page 5: The Virtual Git Summit - Subversion to Git - A Sugar Story

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 5

Page 6: The Virtual Git Summit - Subversion to Git - A Sugar Story

Approaches to SVN to Git Migration

!   Physically migrate existing SVN repository !  Helps maintain history !  Allows you to quit SVN cold

turkey

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 6

Page 7: The Virtual Git Summit - Subversion to Git - A Sugar Story

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 7

Page 8: The Virtual Git Summit - Subversion to Git - A Sugar Story

The approach we took

!   Start fresh with git !  Allowed us to re-think our code structure !  Got rid of lots of old and unused code !  Avoided the problems of doing a migration

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 8

Page 9: The Virtual Git Summit - Subversion to Git - A Sugar Story

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 9

Create new git repo

Export SVN working

copy

Import SVN export into

newly created git

repo

Have devs change from svn

checkouts to git clones

Setup SVN mirroring

from GitHub

Page 10: The Virtual Git Summit - Subversion to Git - A Sugar Story

Why GitHub?

!   Wanted offsite secure code hosting provider !   Very easy to use web based management of

repository !  ACL !  Simple file changes can be done online !  Visual history management

!   SVN read ( and now write ) access for legacy clients !   Pull requests and forking made simple

!  Enables pre-commit reviewing easily

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 10

Page 11: The Virtual Git Summit - Subversion to Git - A Sugar Story

How did it go initially?

!   #wins !  Average time to do a merge went down to about an hour

!   Fewer conflicts !  Apply a fix to multiple branches now takes a minute

!   No longer a manual process !   #fails

!  Had to rethink our initial branching strategy !   More on this later

!  Challenging for developers working on older and newer releases at the same time !   Resolved once older releases went away

!   Learning curve for git tools !   Took around 6 months before team was really proficient

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 11

Page 12: The Virtual Git Summit - Subversion to Git - A Sugar Story

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 12

What have we gained?

Page 13: The Virtual Git Summit - Subversion to Git - A Sugar Story

Pull Requests!

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 13

Page 14: The Virtual Git Summit - Subversion to Git - A Sugar Story

Advantages of Pull Requests

!   More natural approach to pre-commit code reviewing !  Uses git forks to enable pushing commits up to main

repository !   Enables true two-way peer review

!   Inline commenting !  Can directly track submitter and reviewer !  Easy for submitter to update pull request

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 14

Page 15: The Virtual Git Summit - Subversion to Git - A Sugar Story

New initiatives due to Pull Requests

!   Open+ Developer Program !  Enables our VAR and ISV partners to have direct access to

the Sugar codebase. !   They can contribute fixes directly to us that we can review

and accept into the product !   Community Branch

!  Allows our community members to make pull requests against our open source version, that we pull into the product

!   Both initiatives has resulted in over 100 code contributions over the last year, over 5x as much as the previous year.

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 15

Page 16: The Virtual Git Summit - Subversion to Git - A Sugar Story

Change in branching strategy

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 16

Page 17: The Virtual Git Summit - Subversion to Git - A Sugar Story

What we did back in SVN

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 17

Page 18: The Virtual Git Summit - Subversion to Git - A Sugar Story

Now what we can do with git

!   Feature branches that aren’t painful to merge !   Bug fix dumping ground branch that we can pull fixes

from to build maintenance releases

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 18

Page 19: The Virtual Git Summit - Subversion to Git - A Sugar Story

Git branching strategy

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 19

Page 20: The Virtual Git Summit - Subversion to Git - A Sugar Story

Takeaways

! Git solved the scalability needs that Subversion didn’t !  Enables more distributed development with less integration

time !  Allows us to define our branching strategy less around the

tool and more around the process !   Moving to Git without migrating old commits was a

#win !  Unshackled us from the SVN paradigm of the past

! GitHub is a kick butt tool !  Provides tools to make code reviews better and fit more into

the natural flow of development !  Easily enables community around your codebase

1/25/12 ©2011 SugarCRM Inc. All rights reserved. 20

Page 21: The Virtual Git Summit - Subversion to Git - A Sugar Story

Questions?

©2011 SugarCRM Inc. All rights reserved.