172
WiFi: username / password

Be a Happier Developer with Git / Productive Team #gettinggitright

Embed Size (px)

DESCRIPTION

2014/9/26開催 アトラシアン「Getting Git Right 〜 きっとできる Git セミナー」 https://atlassianggrtokyo.attendease.com/ 講演者 1 Tim Pettersen (Developer Advocate, Atlassian) 講演者 2 Abhin Chhabra (Bitbucket Developer, Atlassian) 録画はこちら

Citation preview

Page 1: Be a Happier Developer with Git / Productive Team #gettinggitright

WiFi: username / password

Page 2: Be a Happier Developer with Git / Productive Team #gettinggitright

A couple of Atlassians who get Git and dig the DAG

Tim PettersenDeveloper Advocate

@kannonboy

Abhin ChhabraBitbucket Developer

@abhin_chhabra

Page 3: Be a Happier Developer with Git / Productive Team #gettinggitright

The State of Git 15 min

Happier Developers 40 min

A bit about Stash 10 mins

Productive Teams 40 min

Break 10 min

Page 4: Be a Happier Developer with Git / Productive Team #gettinggitright

• Fill out survey, win awesome stuff (check the email you registered with)

!

• Tweet stuff with #gettinggitright !

• WiFi: username / password !

• Bathroom?

Page 5: Be a Happier Developer with Git / Productive Team #gettinggitright

Who knows

?

Page 6: Be a Happier Developer with Git / Productive Team #gettinggitright

Facts

500 Developers

Page 7: Be a Happier Developer with Git / Productive Team #gettinggitright

Facts

1000+ Nerds

Page 8: Be a Happier Developer with Git / Productive Team #gettinggitright

Facts

working on 9 products

Page 9: Be a Happier Developer with Git / Productive Team #gettinggitright

SoftwareWe

or in just 3 words

Page 10: Be a Happier Developer with Git / Productive Team #gettinggitright

SoftwareWe Teams

Page 11: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 12: Be a Happier Developer with Git / Productive Team #gettinggitright

really small team

they know what’s going on!

Let’s do it!

Great idea!

Productivity++

Page 13: Be a Happier Developer with Git / Productive Team #gettinggitright

team is growing

Let’s do it! Great! Why?

Who will do it?Is it done? Have you

talked to QA?

I have no time for this!

Productivity?

Page 14: Be a Happier Developer with Git / Productive Team #gettinggitright

Productivity??

we’re not alone

Is it profitable?!

When is it done?!

Page 15: Be a Happier Developer with Git / Productive Team #gettinggitright

is a

Devel ping S ftware

S cial Challenge

Page 16: Be a Happier Developer with Git / Productive Team #gettinggitright

Tools

happy developers & productive teams Ship software

faster & smarter

Page 17: Be a Happier Developer with Git / Productive Team #gettinggitright

Ship software faster & smarter

happy developers & productive teams

Page 18: Be a Happier Developer with Git / Productive Team #gettinggitright

Git is on the rise

15%

38%

from 2011 to 2013Source: RedMonk Git Survey 2013

Page 19: Be a Happier Developer with Git / Productive Team #gettinggitright

Git will continue to grow!

63%

37%

December 2015

Git

CVS + SVN

Source: Atlassian Git Survey 2013

Page 20: Be a Happier Developer with Git / Productive Team #gettinggitright

Git works for the enterprise!

60%100+ developers

1,000+ employees

Source: Atlassian Git Survey 2013

Page 21: Be a Happier Developer with Git / Productive Team #gettinggitright

Git works for the enterprise!

27%

69%

use the cloud

develop on-premise

Source: CollabNet Git Survey 2013

Page 22: Be a Happier Developer with Git / Productive Team #gettinggitright

Git means fast releases

Git

SVN CVS

mainly daily - weekly

mainly monthly

Source: Atlassian Git Survey 2013

Page 23: Be a Happier Developer with Git / Productive Team #gettinggitright

Better code with Git

Code Reviews when using GIT

+15% more

thank you Pull Requests!

Source: Atlassian Git Survey 2013

Page 24: Be a Happier Developer with Git / Productive Team #gettinggitright

atlassian.com/git

Migrating soon?

Page 25: Be a Happier Developer with Git / Productive Team #gettinggitright

is just a tool!

Page 26: Be a Happier Developer with Git / Productive Team #gettinggitright

WiFi: bcenter

Page 27: Be a Happier Developer with Git / Productive Team #gettinggitright

Happier Developerwith

Be a

Erik van Zijst!Bitbucket Developer

Tim Pettersen!Developer Advocate

September 2014!with! and!

Page 28: Be a Happier Developer with Git / Productive Team #gettinggitright

Happier Developerwith

Be a

Abhin Chhabra !Bitbucket Developer

Tim Pettersen!Developer Advocate

September 2014!with! and!

Page 29: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 30: Be a Happier Developer with Git / Productive Team #gettinggitright

Time machine without paradoxes?

Page 31: Be a Happier Developer with Git / Productive Team #gettinggitright

Explore & Understand

1

3

Speed, Speed, Speed

Control and Assemble4

Why does make you happy?

2 Freedom & Safety

Page 32: Be a Happier Developer with Git / Productive Team #gettinggitright

1

Fast is the new Black

Speed, speed, Speed

Page 33: Be a Happier Developer with Git / Productive Team #gettinggitright

Everything is local

Except push & pull

Page 34: Be a Happier Developer with Git / Productive Team #gettinggitright

Written in C by Linux kernel and filesystem

developers

Page 35: Be a Happier Developer with Git / Productive Team #gettinggitright

Read: fast :D

Page 36: Be a Happier Developer with Git / Productive Team #gettinggitright

But what if my repo is big?

446k lines of code added

1

3

Recent Linux kernel release (3.13) has 15+ million LOC

1,339 contributors4

2 12,000 non-merge commits

source lwn.net

Page 37: Be a Happier Developer with Git / Productive Team #gettinggitright

2 Freedom & Safety

Page 38: Be a Happier Developer with Git / Productive Team #gettinggitright

Feature Branching

Page 39: Be a Happier Developer with Git / Productive Team #gettinggitright

Feature Branching

Page 40: Be a Happier Developer with Git / Productive Team #gettinggitright

Feature branches: local

git checkout -b new-branch creates a branch and switches to it

Page 41: Be a Happier Developer with Git / Productive Team #gettinggitright

Feature branches: published (remote)

git push origin new-branch pushes a local branch remotely

Page 42: Be a Happier Developer with Git / Productive Team #gettinggitright

git stash is awesomeIt’s a way to

temporarily save your work on a stack

Page 43: Be a Happier Developer with Git / Productive Team #gettinggitright

So if your boss comes screaming at your desk

Page 44: Be a Happier Developer with Git / Productive Team #gettinggitright

Safety

Page 45: Be a Happier Developer with Git / Productive Team #gettinggitright

Losing work is very hard

very very

Page 46: Be a Happier Developer with Git / Productive Team #gettinggitright

maybe your git server crashed and the hd is

corrupted?… no problem

Page 47: Be a Happier Developer with Git / Productive Team #gettinggitright

Redundancy, every developer has a clone

Page 48: Be a Happier Developer with Git / Productive Team #gettinggitright

Chain of unlosability

Page 49: Be a Happier Developer with Git / Productive Team #gettinggitright

Recover a file

git checkout file-name

Page 50: Be a Happier Developer with Git / Productive Team #gettinggitright

Recover a commit

git checkout sha-1

git checkout ref (branch/tag)

or

Page 51: Be a Happier Developer with Git / Productive Team #gettinggitright

Print file as in branch

git show branch:path/to/file

can be any ref

Page 52: Be a Happier Developer with Git / Productive Team #gettinggitright

find a deleted method

git log -S<string> search through all history

Page 53: Be a Happier Developer with Git / Productive Team #gettinggitright

When all is lost, use the reflog

Page 54: Be a Happier Developer with Git / Productive Team #gettinggitright

More on recovery!http://bit.do/recovering

Page 55: Be a Happier Developer with Git / Productive Team #gettinggitright

Explore & Understand 3

Page 56: Be a Happier Developer with Git / Productive Team #gettinggitright

= history superpowers

Hard Questions to git logAsk

-S string in all diffs--after,--before when?--author who did what

Page 57: Be a Happier Developer with Git / Productive Team #gettinggitright

Who deleted that?git log -1 -- [path] lists where a file was deleted

git log --diff-filter=D --summary lists all deleted files

Page 58: Be a Happier Developer with Git / Productive Team #gettinggitright

Where is that constant?

git grep <regexp> compare the speed between this and regular grep or ack…you’ll be blown

away

Page 59: Be a Happier Developer with Git / Productive Team #gettinggitright

have I merged this?

git branch --no-merged lists branches not merged

git branch --merged lists branches already merged

Page 60: Be a Happier Developer with Git / Productive Team #gettinggitright

Control and Assemble4

Page 61: Be a Happier Developer with Git / Productive Team #gettinggitright

What is a merge?

Merge commit

master

feature

merges keep the context of the

feature’s commits

Page 62: Be a Happier Developer with Git / Productive Team #gettinggitright

git knows the ancestry

1

2

The merge is local

powerful merge strategies3

merge is better in git

Page 63: Be a Happier Developer with Git / Productive Team #gettinggitright

merge becomes a non-event

In most cases

Page 64: Be a Happier Developer with Git / Productive Team #gettinggitright

rebase: Rewrite history with safety belts on

Page 65: Be a Happier Developer with Git / Productive Team #gettinggitright

feature

master

What is a rebase?

It’s a way to replay commits, one by one,

on top of a branch

Page 66: Be a Happier Developer with Git / Productive Team #gettinggitright

master

feature

What is a rebase?

preserving the order of commits

Page 67: Be a Happier Developer with Git / Productive Team #gettinggitright

What is an --interactive rebase?

It’s a way to replay commits, one by one,

deciding interactively what to do with each

reword fixup

pick squash

edit exec

Page 68: Be a Happier Developer with Git / Productive Team #gettinggitright

CUSTOMARY WARNING!

rebase rewrites history!

Treat this power with great care. Only rewrite history of local branches or…

Page 69: Be a Happier Developer with Git / Productive Team #gettinggitright

Explore & Understand

1

3

Speed, Speed, Speed

Control and Assemble4

Why does make you happy?

2 Freedom & Safety

Page 70: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 71: Be a Happier Developer with Git / Productive Team #gettinggitright

Happy Developerwith

A

Page 72: Be a Happier Developer with Git / Productive Team #gettinggitright

WiFi: bcenter

Page 73: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 74: Be a Happier Developer with Git / Productive Team #gettinggitright

Productive Team withA

Page 75: Be a Happier Developer with Git / Productive Team #gettinggitright

Improving Code Quality

1

2

Efficient Workflows

Better Collaboration3

Why makes a team great!

4 Natural Fit

Page 76: Be a Happier Developer with Git / Productive Team #gettinggitright

Efficient Workflows

Page 77: Be a Happier Developer with Git / Productive Team #gettinggitright

upcoming Release ?Can we still fix a bug for the

FeatureIs the code for that

complete?

for the current version?HotfixHow do we

do

ReviewedHas everyone

the code for this feature ?

Page 78: Be a Happier Developer with Git / Productive Team #gettinggitright

Git workflow?What’s the best

We don’t know!

Page 79: Be a Happier Developer with Git / Productive Team #gettinggitright

+ different teams+ different products

different cultures

= different workflows

Git workflow?What’s the best

Page 80: Be a Happier Developer with Git / Productive Team #gettinggitright

DesignWorkflows

your own

Page 81: Be a Happier Developer with Git / Productive Team #gettinggitright

Issues Code

Page 82: Be a Happier Developer with Git / Productive Team #gettinggitright

Issues Code

JIRA-456

JIRA-123JIRA-123

JIRA-456

Page 83: Be a Happier Developer with Git / Productive Team #gettinggitright

Can’t be released right now

Unfinished features in your trunk / master branch

Page 84: Be a Happier Developer with Git / Productive Team #gettinggitright

Branch per issueFirst:

feature/JIRA-30

stable master branch

isolated feature work

master

Page 85: Be a Happier Developer with Git / Productive Team #gettinggitright

feature/JIRA-30-user-

Branch per issueFirst:

branch type

issue key

description

Page 86: Be a Happier Developer with Git / Productive Team #gettinggitright

bugfix/JIRA-31-

Branch per issueFirst:

branch type

issue key

description

Page 87: Be a Happier Developer with Git / Productive Team #gettinggitright

hotfix/JIRA-32-broke-

Branch per issueFirst:

branch type

issue key

description

Page 88: Be a Happier Developer with Git / Productive Team #gettinggitright

Typos happne!Tool switching sucks

Page 89: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 90: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 91: Be a Happier Developer with Git / Productive Team #gettinggitright

Is the branch green?

Branch name pre-populated

Page 92: Be a Happier Developer with Git / Productive Team #gettinggitright

Confounding build breakages

master

Page 93: Be a Happier Developer with Git / Productive Team #gettinggitright

Confounding build breakages

bugfix/

master

Page 94: Be a Happier Developer with Git / Productive Team #gettinggitright

Atlassian Marketplace1Workflow

SAAS Workflow

Page 95: Be a Happier Developer with Git / Productive Team #gettinggitright

Simplest Workflow

release from here

feature/JIRA-30

feature/JIRA-45

master

Page 96: Be a Happier Developer with Git / Productive Team #gettinggitright

Simple Workflowrelease from here

feature/JIRA-30

feature/JIRA-45

develop

masterintegrate here

Page 97: Be a Happier Developer with Git / Productive Team #gettinggitright

Atlassian Stash2Workflow

Installable software

Page 98: Be a Happier Developer with Git / Productive Team #gettinggitright

Multiple Product Versions

feature/JIRA-30

master

v 1.2

v 1.1

Page 99: Be a Happier Developer with Git / Productive Team #gettinggitright

Multiple Product Versions

master

v 1.2

v 1.1

bugfix/JIRA-41

Page 100: Be a Happier Developer with Git / Productive Team #gettinggitright

Multiple Product Versions

master

v 1.2

v 1.1

bugfix/JIRA-41

Page 101: Be a Happier Developer with Git / Productive Team #gettinggitright

Multiple Product Versions

master

v 1.2

v 1.1

bugfix/JIRA-45

Page 102: Be a Happier Developer with Git / Productive Team #gettinggitright

Multiple Product Versions

master

v 1.2

v 1.1

bugfix/JIRA-45

Page 103: Be a Happier Developer with Git / Productive Team #gettinggitright

Multiple Product Versions

master

v 1.2

v 1.1

bugfix/JIRA-45

boring work

Page 104: Be a Happier Developer with Git / Productive Team #gettinggitright

Automatic merges

https://bitbucket.org/durdn/automatic-merge-hook

with a Git hook

Page 105: Be a Happier Developer with Git / Productive Team #gettinggitright

Automatic mergeswith Stash

Page 106: Be a Happier Developer with Git / Productive Team #gettinggitright

Design your workflow

Nearly everything is possible with

Page 107: Be a Happier Developer with Git / Productive Team #gettinggitright

Improving Code Quality

Page 108: Be a Happier Developer with Git / Productive Team #gettinggitright

CodeReview

Photo: Yogi (Flickr)

Page 109: Be a Happier Developer with Git / Productive Team #gettinggitright

Better Code

Shared Knowledge

Team Ownership

Page 110: Be a Happier Developer with Git / Productive Team #gettinggitright

G = 1

R+1

Developer guilt

Page 111: Be a Happier Developer with Git / Productive Team #gettinggitright

Team Ownership

Page 112: Be a Happier Developer with Git / Productive Team #gettinggitright

Code Reviews

Page 113: Be a Happier Developer with Git / Productive Team #gettinggitright

Pull Requests

Page 114: Be a Happier Developer with Git / Productive Team #gettinggitright

Pull Requests

Page 115: Be a Happier Developer with Git / Productive Team #gettinggitright

do it before merge

Pull Requests

Page 116: Be a Happier Developer with Git / Productive Team #gettinggitright

Pull Request Creation

Page 117: Be a Happier Developer with Git / Productive Team #gettinggitright

Pull Request Creation

Page 118: Be a Happier Developer with Git / Productive Team #gettinggitright

Pull Request Creation

Page 119: Be a Happier Developer with Git / Productive Team #gettinggitright

Discuss

Discuss your changes

Page 120: Be a Happier Developer with Git / Productive Team #gettinggitright

Discuss your changes

Page 121: Be a Happier Developer with Git / Productive Team #gettinggitright

Side by side diff the choice is yours

Page 122: Be a Happier Developer with Git / Productive Team #gettinggitright

invited reviewers

Page 123: Be a Happier Developer with Git / Productive Team #gettinggitright

invited reviewers

minimum X approvals

Go merge!

Page 124: Be a Happier Developer with Git / Productive Team #gettinggitright

Pull Request Merge Checks

Page 125: Be a Happier Developer with Git / Productive Team #gettinggitright

Who would be

the best to reviewmy code?

Page 126: Be a Happier Developer with Git / Productive Team #gettinggitright

Auto Suggest Reviewers

Free Add On For

Page 127: Be a Happier Developer with Git / Productive Team #gettinggitright

Auto Suggest Reviewers

suggestions

why?

Page 128: Be a Happier Developer with Git / Productive Team #gettinggitright

committed code to this Pull Request

Suggestions:

contributed files that were modified

Page 129: Be a Happier Developer with Git / Productive Team #gettinggitright

Better Collaboration

Page 130: Be a Happier Developer with Git / Productive Team #gettinggitright

Working with contractors?

Page 131: Be a Happier Developer with Git / Productive Team #gettinggitright

Circle of Trust

Photo: Aljaz Zajc

Page 132: Be a Happier Developer with Git / Productive Team #gettinggitright

Strangers on the internet

Contractors

Interns

Other product teams

SupportCore dev team

Circle of Trust

Page 133: Be a Happier Developer with Git / Productive Team #gettinggitright

Collaboration with SVN

Core dev team

Everyone else

emailing patches repository tarballs hell-ish conflicts

Page 134: Be a Happier Developer with Git / Productive Team #gettinggitright

Collaboration with forks

Everyone else

Core dev team Changes

automatically synchronize downstream

.. but must be reviewed

before moving upstream

Page 135: Be a Happier Developer with Git / Productive Team #gettinggitright

feature

Collaboration with branches

Senior developers

Junior developers

maste

Page 136: Be a Happier Developer with Git / Productive Team #gettinggitright

Permissions for Branches with

Page 137: Be a Happier Developer with Git / Productive Team #gettinggitright

Permissions for Branches with

Page 138: Be a Happier Developer with Git / Productive Team #gettinggitright

Strangers on the internet

Interns

Other product teams

SupportCore dev team

Contractors

Page 139: Be a Happier Developer with Git / Productive Team #gettinggitright

Know your priorities

Security DevSpeed

Page 140: Be a Happier Developer with Git / Productive Team #gettinggitright

Natural Fit

to your existing flow

Page 141: Be a Happier Developer with Git / Productive Team #gettinggitright

There is so much going on in our projects!

Pull Requests

Sprints

Builds

Issues

Branches

Page 142: Be a Happier Developer with Git / Productive Team #gettinggitright

& CI

Page 143: Be a Happier Developer with Git / Productive Team #gettinggitright

manually triggered

automatically triggered

Building branches

maste

always build master

Page 144: Be a Happier Developer with Git / Productive Team #gettinggitright

Less time configuringmore time to code

Page 145: Be a Happier Developer with Git / Productive Team #gettinggitright

Every line of code starts with

Real Life Problema

Page 146: Be a Happier Developer with Git / Productive Team #gettinggitright

Every line of code starts with

Issuean

Page 147: Be a Happier Developer with Git / Productive Team #gettinggitright

Visualize your development

IN PROGRESS

Status People Code

Issue

good old days

Page 148: Be a Happier Developer with Git / Productive Team #gettinggitright

Visualize your development

Issue

Sprint Branch Pull Request

Build

2014 style

Page 149: Be a Happier Developer with Git / Productive Team #gettinggitright

Visualize your development

Page 150: Be a Happier Developer with Git / Productive Team #gettinggitright

Automatic Issue Transitions

feature/JIRA-30

master

IN REVIEW DONEIN PROGRESSOPEN

Page 151: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 152: Be a Happier Developer with Git / Productive Team #gettinggitright

See what’s going onBuildswithBots

PagesIssues Branches Pull Requests etc.

Page 153: Be a Happier Developer with Git / Productive Team #gettinggitright

More time to codeBetter collaborationDev productivityThe future

Economics

Why Git?

Deliver software faster

Less bugs

Happy customers

Page 154: Be a Happier Developer with Git / Productive Team #gettinggitright

Why Git?

Ship software faster & smarter

Page 155: Be a Happier Developer with Git / Productive Team #gettinggitright

So now you can answer “Why Git?”

Page 156: Be a Happier Developer with Git / Productive Team #gettinggitright

Let’s talk a little bit about “Why ?”

Page 157: Be a Happier Developer with Git / Productive Team #gettinggitright

Why ?

157

1. BEST enterprise Git workflow 2. Integrations & extensibility 3. Scalability

Page 158: Be a Happier Developer with Git / Productive Team #gettinggitright

158

feature/STASH-123

master

The Best Git Workflow

X reviewers approved? Y builds passed? All tasks complete?

Page 159: Be a Happier Developer with Git / Productive Team #gettinggitright

159

feature/STASH-123

master

The Best Git Workflow

• Pull request merge checks • Repository hooks • Branch permissions • Flexibility & extensibility

Page 160: Be a Happier Developer with Git / Productive Team #gettinggitright

160

Powerful integrations

Page 161: Be a Happier Developer with Git / Productive Team #gettinggitright

161

Plugin APIs • Full Java API • Repository Hooks • Merge Checks • User Interface • REST end-points • Filetype renderers • SSH commands

Stash Platform

Branch Permissions REST APIs Git SCM

Source? You betcha!

Page 162: Be a Happier Developer with Git / Productive Team #gettinggitright

162

RESTful APIs insert /rest/api/latest

Page 163: Be a Happier Developer with Git / Productive Team #gettinggitright

163

RESTful APIs insert /rest/api/latest

Page 164: Be a Happier Developer with Git / Productive Team #gettinggitright

164

Scalability

Request prioritization

Page 165: Be a Happier Developer with Git / Productive Team #gettinggitright

165

Scalability

Request queuing

Page 166: Be a Happier Developer with Git / Productive Team #gettinggitright

166

Scalability

Response Caching

Page 167: Be a Happier Developer with Git / Productive Team #gettinggitright

167

Scalability

Clustering

Page 168: Be a Happier Developer with Git / Productive Team #gettinggitright

All sorts of teams are on&

Page 169: Be a Happier Developer with Git / Productive Team #gettinggitright
Page 170: Be a Happier Developer with Git / Productive Team #gettinggitright

Why ?

170

• BEST enterprise Git workflow • Integrations & extensibility • Scalability

Page 171: Be a Happier Developer with Git / Productive Team #gettinggitright

Please fill out our survey

to get a t-shirt

win wireless headphones

tweet #gettinggitright

Fill out our survey to

Get a “Stash” photo and

(check your email)

Page 172: Be a Happier Developer with Git / Productive Team #gettinggitright

Q & A$10 for up to 10 devs

Free for 5 users Totally free

Free basic version