Slide 1

Slide 1 text

Get Good with Git Using Version Control to Deliver Quality Software

Slide 2

Slide 2 text

2008 - 2012 MEng Software Engineering

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

I’m the Head of Development at 3Squared

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Version Control is Key to our Success !

Slide 9

Slide 9 text

Who has used a Version Control System? "

Slide 10

Slide 10 text

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.

Slide 11

Slide 11 text

We use Git

Slide 12

Slide 12 text

Git is a Distributed Version Control System (DVCS) #

Slide 13

Slide 13 text

Designed for Linux Development

Slide 14

Slide 14 text

I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'. - Linus Torvalds

Slide 15

Slide 15 text

It has Lots of Benefits $ It allows us to…

Slide 16

Slide 16 text

Backup our Work %

Slide 17

Slide 17 text

Work as a Team &

Slide 18

Slide 18 text

Work Offline ✈

Slide 19

Slide 19 text

Do things Fast ⚡

Slide 20

Slide 20 text

Identify, Diagnose & Fix Bugs ()

Slide 21

Slide 21 text

Bug!

Slide 22

Slide 22 text

Bug! git bisect

Slide 23

Slide 23 text

Bad

Slide 24

Slide 24 text

Good Bad

Slide 25

Slide 25 text

Step 1 Good Bad

Slide 26

Slide 26 text

Good Bad Step 1 Bad

Slide 27

Slide 27 text

Step 2 Good Bad

Slide 28

Slide 28 text

Step 2 Good Good Bad

Slide 29

Slide 29 text

Good Bad Step 3

Slide 30

Slide 30 text

Good Bad Step 3 Good

Slide 31

Slide 31 text

Good Bad First Bad Commit

Slide 32

Slide 32 text

Be Flexible *

Slide 33

Slide 33 text

But…

Slide 34

Slide 34 text

With Great Power comes Great Responsibility

Slide 35

Slide 35 text

Effective Team Work requires Rules +

Slide 36

Slide 36 text

Write descriptive Commit Messages ✏ Explain why you did something

Slide 37

Slide 37 text

Commit Early & Commit Often -

Slide 38

Slide 38 text

Follow a Branching Policy .

Slide 39

Slide 39 text

We use Git-Flow

Slide 40

Slide 40 text

The Main Branches • master represents code in a production ready state. • Each commit on master is tagged with a release number • develop represents code for the next release.

Slide 41

Slide 41 text

Feature Branches • Developing features for the next release. • Branch from: develop • Merge into: develop • Named: feature/_, e.g. feature/login • Multiple features can be worked on in parallel by the team.

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Release Branches • Prepare for production when all features are complete. • Branch from: develop • Merge into: develop & master • Named: release/_, e.g. release/1.0.1 • Only one release at a time. • Merge with master is tagged with the release number.

Slide 44

Slide 44 text

Hotfix Branches • Used to quickly react to critical bugs in production. • Branch from: master • Merge into: develop & master • Named: hotfix/_, e.g. release/1.2.1 • Other team member can carry on with feature work.

Slide 45

Slide 45 text

http://nvie.com/posts/a-successful-git-branching-model/

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

Git & Git-Flow Caveats ⚠

Slide 50

Slide 50 text

A Release contains all Completed Features 0

Slide 51

Slide 51 text

Merge Conflicts will occur 1 so approach them in the right way…

Slide 52

Slide 52 text

Communicate with your Team 2 to minimise changes to the same file across branches

Slide 53

Slide 53 text

Prevent Feature Divergence 3 by periodically merging develop into feature branches

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

Potentially nasty merge conflicts

Slide 56

Slide 56 text

Smaller merge conflicts Smaller merge conflicts

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

Collaboration requires Connectivity 4

Slide 59

Slide 59 text

Use a Centralised “Truth” Repository 5

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

Git Repositories Hosted Internally 6

Slide 64

Slide 64 text

Merge Requests used for Code Review 7

Slide 65

Slide 65 text

develop feature branches

Slide 66

Slide 66 text

develop feature branches 8

Slide 67

Slide 67 text

develop feature branches ? Merge Request = code review 8

Slide 68

Slide 68 text

develop feature branches 8

Slide 69

Slide 69 text

develop feature branches ? Merge Request = code review 8

Slide 70

Slide 70 text

develop feature branches Merge Request accepted 8

Slide 71

Slide 71 text

Branches form basis for Deployments 9

Slide 72

Slide 72 text

9!QA 9!QA 9!QA 9!QA

Slide 73

Slide 73 text

9!Stag 9!Stag 9!Stag 9!Prod

Slide 74

Slide 74 text

Summary • Git is enables fast, flexible collaborative software development • Bug-fixing is made easier with git bisect • With Great Power comes Great Responsibility • Following a branching policy like Git-Flow standardises development & deployment processes !"#$%&✈⚡ ()* +✏ -.⚠ 0 1 2 3 4 6 7 9

Slide 75

Slide 75 text

Thank You : [email protected] Twitter / GitHub: lukestringer90