Slide 1

Slide 1 text

Git Workflows That Work Spencer Christensen OpenWest Conference May 2014

Slide 2

Slide 2 text

Git Workflows That Work Prizes to give away!

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

In the year 2010...

Slide 5

Slide 5 text

Gitflow

Slide 6

Slide 6 text

Gitflow ● Filled a void - something that wasn’t there before ● Offered a “successful” workflow ● Rapid adoption ● “The” way to do it

Slide 7

Slide 7 text

Git Workflows That Work I’m not going to present “the” way to do it.

Slide 8

Slide 8 text

TIMTOWTDI

Slide 9

Slide 9 text

What’s the purpose? What is the purpose of a software development workflow using git?

Slide 10

Slide 10 text

What’s the purpose? What is the purpose of software?

Slide 11

Slide 11 text

What’s the purpose? “The purpose of software is to help people.” - Max Kanat-Alexander, Code Simplicity

Slide 12

Slide 12 text

Git Workflows Should Help People ● Business owners ● Project managers ● Operations team ● Developers

Slide 13

Slide 13 text

Git Workflow Examples...

Slide 14

Slide 14 text

GitHub Flow

Slide 15

Slide 15 text

GitHub Flow ● Anything in master is deployable ● Everything branches off master ● Commit branch locally and on origin ● Send pull request to peers for code review ● After approval, merge branch into master ● Once origin master is updated, deploy

Slide 16

Slide 16 text

Skullcandy’s workflow

Slide 17

Slide 17 text

Skullcandy’s workflow ● Scrum, sprints, deliverables ● Each userstory/defect = branch ● Anything in master is deployable ● Everything branches off master ● Commit branch locally and on origin ● Send pull request to peers for code review ● After peer review, merge and deploy to QA ● After business approval and ticket updated- auto merge and deploy ● QA branch is just another branch

Slide 18

Slide 18 text

Master only workflow

Slide 19

Slide 19 text

Master only workflow ● Dev environment is similar to production ● Business owner access to dev environment for testing ● Changes are committed locally ● Peer review by shared access to dev environment, or by pushing local branch to origin ● After approval, merge branch into master ● Once origin master is updated, deploy

Slide 20

Slide 20 text

Gitflow

Slide 21

Slide 21 text

Gitflow ● At least three long running branches- develop, release, and master ● All work is done in a branch ● Features are branched off develop, hot fixes are branched off master ● Develop is merged into a release branch ● Hot fixes are merged into master, and to release, and to develop

Slide 22

Slide 22 text

Gitflow cont’d ● Releases are tagged with a release version number ● Gitflow helper script to make it easier to use.

Slide 23

Slide 23 text

Backcountry workflow

Slide 24

Slide 24 text

Backcountry workflow ● Different branch names, similar flow ○ master, release, production ● Hotfixes and features branch off master ● Weekly regular release, but emergency release for hot fixes ● Often used ‘cherry-pick’ for just the commits approved to release

Slide 25

Slide 25 text

Guidelines

Slide 26

Slide 26 text

Guidelines ● Use branches for single releasable units. ○ A single user story or bug fix. ○ Something that can be approved by the business that contains everything needed for that single request to be released- and nothing more!

Slide 27

Slide 27 text

Guidelines ● Avoid long running branches. ○ The longer a feature branch lives without getting merged in for a release, the greater risk for merge conflicts and challenges for deployment. ○ Short lived branches merge and deploy cleaner.

Slide 28

Slide 28 text

Guidelines ● Business owner involvement in your workflow is essential. ○ Don’t merge, don’t deploy, don’t work without their input. Otherwise pain and tears will ensue (or worse).

Slide 29

Slide 29 text

Guidelines ● Avoid reverts. ○ Test, test, test your branch before a merge. When merging use git merge --no-ff, which will ease merge reverts if really needed.

Slide 30

Slide 30 text

Guidelines ● Your workflow should fit how you release. ○ Do you release continually, multiple times a day? ○ Do you have 2 week sprints, thus a regular schedule? ○ Do you have a business Change Control Board? ○ Does someone else run your releases? ○ Your branching and merging strategy needs to make releasing easier.

Slide 31

Slide 31 text

Guidelines ● Make your workflow simple. ○ Complicated workflows drive people crazy. ○ Ask how you can simplify it. ○ Actively making things more simple will make them easier to understand and work with as well as easier for others to adopt and maintain.

Slide 32

Slide 32 text

Guidelines Summary ● Use branches for single releasable units. ● Avoid long running branches. ● Business owner involvement in your workflow is essential. ● Avoid reverts. ● Your workflow should fit how you release. ● Make your workflow simple.

Slide 33

Slide 33 text

Software Development Processes Development Deployment Maintenance

Slide 34

Slide 34 text

Software Development Processes Planning Prioritizing Development Acceptance Deployment Evaluation Maintenance

Slide 35

Slide 35 text

Further Reading ● http://www.codesimplicity.com/post/the-purpose-of-software/ ● http://nvie.com/posts/a-successful-git-branching-model/ ● http://www.kdgregory.com/index.php?page=scm.git ● https://sandofsky.com/blog/git-workflow.html ● http://stackoverflow.com/questions/2428722/git-branch-strategy- for-small-dev-team ● http://git-scm.com/book/en/Git-Branching-Branching-Workflows ● https://www.atlassian.com/git/workflows

Slide 36

Slide 36 text

Prizes!

Slide 37

Slide 37 text

Git Workflows That Work Spencer Christensen OpenWest Conference May 2014