Top Banner
Embracing Distributed Version Control How to Drastically Improve Collaboration, Experimentation, Productivity, Freedom, Flexibility, Data Integrity and take two strokes off of your golf game
28

Embracing Distributed Version Control

Jan 13, 2015

Download

Technology

Nowell Strite

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Embracing Distributed Version Control

Embracing Distributed Version Control

How to Drastically Improve Collaboration, Experimentation,

Productivity, Freedom, Flexibility, Data Integrity and take two strokes off

of your golf game

Page 2: Embracing Distributed Version Control

Lets Talk About It

Open Forum • Ask questions• Ask for demonstrations  • Add opinions• Share experiences• Try it yourself

Page 3: Embracing Distributed Version Control

What's the Big Deal?

• Tools should mold to your process• Projects have lots of independent features• Feature isolation • "Major Milestone" vs. "Release Often"• "Only commit when its done" is limiting

Page 4: Embracing Distributed Version Control

The Basics

 

Page 5: Embracing Distributed Version Control

Centralized Version Control Systems• One centralized server with the revision database

o single point of failure• Clients checkout a working copy to their machine• Most operations happen on the server• Checkouts/Updates happen one directory at a time• Linear revision history (merges squash commits)• Every directory contains a "special folder"

 

Page 6: Embracing Distributed Version Control

Distributed Version Control Systems• Every client has a full revision history locally

o # backups == # clients o no need to be online

• All operations are local (except sharing)• Non-linear revision history• Network operations are compressed into packed

downloads • Working copy is independent of versioning system

Page 7: Embracing Distributed Version Control

Different to the Core

Page 8: Embracing Distributed Version Control

How Did We Get Here Again?

 

Page 9: Embracing Distributed Version Control

There Can Only Be One... or maybe two• Everyone has their own opinions• In the end choose what system fits best

o but whatever you do, choose a DVCS (at least for your local development)

• Today we will compare SVN and GIT

Page 10: Embracing Distributed Version Control

Lets Take a Walk... Side by SideSVN GIT

Obtain Code svn checkout <url> git clone <url>

Add Files svn add file1.php *.css git add file1.php *.css

Status svn status git status

Differences svn diff | less git diff

Restore File svn revert <path> git checkout <path>

Commit All Changes svn commit git commit -a

Get Latest Updates svn update git pull

Share Latest Edits git push

Page 11: Embracing Distributed Version Control

Branching

 

Page 12: Embracing Distributed Version Control

I've Branched Before... So What?

• With CVCS branching is used to separate major releases

• Branching is always followed by merging• Both tasks need to be easy and inexpensive

Page 13: Embracing Distributed Version Control

Branching is Hard... Or is it?

Tasks1.Obtain the source code– Create Branch– Switch Branch– Merge Branch

Page 14: Embracing Distributed Version Control

Branching is Hard... Or is it?

        REPO=http://svn.php.net/repository/php/php-src/1. svn checkout $REPO/trunk  (10 minutes)– svn copy $REPO/branches/PHP_5_3 $REPO/branches/PHP_5_5  (4

minutes)– svn switch $REPO/branches/PHP_5_5   (50 seconds)– svn merge -r 20:HEAD $REPO/branches/PHP_5_3 (claw your eyes out)

 Total Time: ~15 minutes + clawing your eyes out Total Time Branching: ~5 minutes  

Page 15: Embracing Distributed Version Control

Branching is Hard... Or is it?

 1.git clone git://github.com/php/php-src.git  (3

minutes) – git branch PHP_5_5 origin/PHP_5_3  (5

milliseconds)– git checkout PHP_5_5   (2 seconds)– git merge origin/PHP_5_3   (1 second) Total Time: ~3 minutesTotal Time Branching: ~3 seconds

Page 16: Embracing Distributed Version Control

OK. So Branching Is Easy... Now What?• Cheap and easy branching fundamentally changes

the way you approach development• Everything is done on a branch• Issue isolation is now a reality

Page 17: Embracing Distributed Version Control

Every Change Has Its Place in a BranchYou can use any branching style you choose. Here's an example:• master

o also referred to as trunk• hotfix-X

o quick fixes to master • develop

o integration point for all completed feature branches

• feature-Yo every discreet issue is worked on in a feature

branch

complete walk-through: http://nvie.com/git-model

Page 18: Embracing Distributed Version Control
Page 19: Embracing Distributed Version Control

Workflow

 

Page 20: Embracing Distributed Version Control

Your Centralized Workflow

With Centralized Version Control Systems, your workflow will always look like this.

image source: http://whygitisbetterthanx.com

Page 21: Embracing Distributed Version Control

Chose Your Own Adventure WorkflowWith Distributed Version Control Systems you can morph your workflow to meet your needs. You can do it the same...

image source: http://whygitisbetterthanx.com

Page 22: Embracing Distributed Version Control

Or It Can Work Like This...

Integration Manager Approach• Useful for small to large teams• Integration manager merges all feature branches

into mainline

Page 23: Embracing Distributed Version Control

Or It Can Work Like This...

Dictator and Lieutenants• Useful for large teams• Team Leaders curate new feature branches into

production ready state • Dictator has final say and merged into mainline

Page 24: Embracing Distributed Version Control

Migration & Integration

 

Page 25: Embracing Distributed Version Control

Dipping Your Toes in the Water

• Use your favorite DVCS with most other VCS repositories

• Push and Pull changes between systems 

Page 26: Embracing Distributed Version Control

Diving in Head First

• Import entire history/branches from legacy systems• Rinse & repeat: make you have everything before

you switch

Page 27: Embracing Distributed Version Control

References

GIT • http://git-scm.com/course/svn.html• http://whygitisbetterthanx.com/• http://nvie.com/git-model/ • http://progit.org/book/ • http://gitref.org/ • http://gitready.com/

 Mercurial • http://hginit.com/

Page 28: Embracing Distributed Version Control

Get In Touch

Nowell Strite• Twitter: nowells• Email: [email protected]

 Matthew Weier O'Phinney• Twitter: weierophinney• Email: [email protected]