+ All Categories
Transcript
Page 1: Don't Fear the Branch - Marcus Bertrand

#atlassian

Page 2: Don't Fear the Branch - Marcus Bertrand

MARCUS BERTRAND • BITBUCKET DEVELOPER • @MARCUSBERTRAND

Don’t Fear the BranchBranching workflows used in Bitbucket and Stash

Page 3: Don't Fear the Branch - Marcus Bertrand

You should be using branches

Page 4: Don't Fear the Branch - Marcus Bertrand

W H Y G I T

W H Y Y O U A R E N ’ T

You should be using branches

A N AT O M Y O F A B R A N C H

Page 5: Don't Fear the Branch - Marcus Bertrand

Too complex

Page 6: Don't Fear the Branch - Marcus Bertrand

No visibility

Page 7: Don't Fear the Branch - Marcus Bertrand

Merging is difficult

Page 8: Don't Fear the Branch - Marcus Bertrand

W H Y G I T

W H Y Y O U A R E N ’ T

You should be using branches

A N AT O M Y O F A B R A N C H

Page 9: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

Page 10: Don't Fear the Branch - Marcus Bertrand

commit

Anatomy of a branch

Page 11: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 12: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 13: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 14: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 15: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 16: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 17: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 18: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 19: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

Page 20: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

100644 blob d30480027f7ef61af129b07a21bae8d0ea13eb2a README.md.git/objects/27/4192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b

tree

Page 21: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

100644 blob d30480027f7ef61af129b07a21bae8d0ea13eb2a README.md.git/objects/27/4192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b

tree

Page 22: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

100644 blob d30480027f7ef61af129b07a21bae8d0ea13eb2a README.md.git/objects/27/4192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b

tree

Page 23: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

100644 blob d30480027f7ef61af129b07a21bae8d0ea13eb2a README.md.git/objects/27/4192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b

tree

blob 21^@====== Readme ======

.git/objects/d3/0480027f7ef61af129b07a21bae8d0ea13eb2a

blob

Page 24: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

100644 blob d30480027f7ef61af129b07a21bae8d0ea13eb2a README.md.git/objects/27/4192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b

tree

blob 21^@====== Readme ======

.git/objects/d3/0480027f7ef61af129b07a21bae8d0ea13eb2a

blob

Page 25: Don't Fear the Branch - Marcus Bertrand

commit 197^@tree 274192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b author Marcus Bertrand <[email protected]> 1408988361 -0700 committer Marcus Bertrand <[email protected]> 1408988361 -0700 !Added a readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Anatomy of a branch

100644 blob d30480027f7ef61af129b07a21bae8d0ea13eb2a README.md.git/objects/27/4192fecfeda9ec03d7ab6cd64d5bc22b2cfb8b

tree

blob 21^@====== Readme ======

.git/objects/d3/0480027f7ef61af129b07a21bae8d0ea13eb2a

blob

Page 26: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

4 9 4 2 f 8 7

commit

Page 27: Don't Fear the Branch - Marcus Bertrand

4 9 4 2 f 8 7

Anatomy of a branch

Page 28: Don't Fear the Branch - Marcus Bertrand

4 9 4 2 f 8 7

Anatomy of a branch

4942f87f225899b15b9f1c1ebe6a4e61663b8568.git/refs/heads/master

branch

Page 29: Don't Fear the Branch - Marcus Bertrand

4 9 4 2 f 8 7

Anatomy of a branch

4942f87f225899b15b9f1c1ebe6a4e61663b8568.git/refs/heads/master

branch

ref: refs/heads/master.git/HEAD

head

Page 30: Don't Fear the Branch - Marcus Bertrand

git checkout -b foo/mybranch

Anatomy of a branch

Page 31: Don't Fear the Branch - Marcus Bertrand

4942f87f225899b15b9f1c1ebe6a4e61663b8568.git/refs/heads/foo/mybranch

branch

4 9 4 2 f 8 7

Anatomy of a branch

ref: refs/heads/foo/mybranch.git/HEAD

head

Page 32: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

tree 9441d4ef753148ce9cb5aee3966fa6e4f5366be5 parent 4942f87f225899b15b9f1c1ebe6a4e61663b8568 author Marcus Bertrand <[email protected]> 1408992616 -0700 committer Marcus Bertrand <[email protected]> 1408992616 -0700 !Made some edits to the readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Page 33: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

tree 9441d4ef753148ce9cb5aee3966fa6e4f5366be5 parent 4942f87f225899b15b9f1c1ebe6a4e61663b8568 author Marcus Bertrand <[email protected]> 1408992616 -0700 committer Marcus Bertrand <[email protected]> 1408992616 -0700 !Made some edits to the readme

.git/objects/49/42f87f225899b15b9f1c1ebe6a4e61663b8568

commit

Page 34: Don't Fear the Branch - Marcus Bertrand

bd1174cd0f30fe9be9efdd41dcd56256340f230e.git/refs/heads/foo/mybranch

branch

4 9 4 2 f 8 7

Anatomy of a branch

ref: refs/heads/foo/mybranch.git/HEAD

head

b d 1 1 7 4 c

Page 35: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

4 9 4 2 f 8 7 b d 1 1 7 4 c

m a s t e r f o o / m y b r a n c h

H E A D

Page 36: Don't Fear the Branch - Marcus Bertrand

git checkout master

Anatomy of a branch

Page 37: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

m a s t e r

f o o / m y b r a n c h

H E A D

Page 38: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

m a s t e r

f o o / m y b r a n c h

Page 39: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

m a s t e r

f o o / m y b r a n c h

H E A D

Page 40: Don't Fear the Branch - Marcus Bertrand

git merge foo/mybranch

Anatomy of a branch

Page 41: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

f o o / m y b r a n c h

m a s t e r

H E A D

Page 42: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

f o o / m y b r a n c h

M

m a s t e r

H E A D

Page 43: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

f o o / m y b r a n c h

M

Page 44: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

f o o / m y b r a n c h

M

m a s t e r

H E A D

Page 45: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

tree f362c42032aff677c1a09c3f070454df5b411239 parent 49a906f5722ad446a131778cea52e3fda331b706 parent bd1174cd0f30fe9be9efdd41dcd56256340f230e author Marcus Bertrand <[email protected]> 1409002123 -0700 committer Marcus Bertrand <[email protected]> 1409002123 -0700 !Merge branch 'foo/mybranch'

.git/objects/36/80d8c8fd182f97cb0e75045e2fed5c7b7613ed

commit

Page 46: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branch

tree f362c42032aff677c1a09c3f070454df5b411239 parent 49a906f5722ad446a131778cea52e3fda331b706 parent bd1174cd0f30fe9be9efdd41dcd56256340f230e author Marcus Bertrand <[email protected]> 1409002123 -0700 committer Marcus Bertrand <[email protected]> 1409002123 -0700 !Merge branch 'foo/mybranch'

.git/objects/36/80d8c8fd182f97cb0e75045e2fed5c7b7613ed

commit

Page 47: Don't Fear the Branch - Marcus Bertrand

Anatomy of a branchH E A D

M

m a s t e r

f o o / m y b r a n c h

Page 48: Don't Fear the Branch - Marcus Bertrand

W H Y G I T

W H Y Y O U A R E N ’ T

You should be using branches

A N AT O M Y O F A B R A N C H

Page 49: Don't Fear the Branch - Marcus Bertrand

Every commit is a full copy of the

repository state at that revision

Page 50: Don't Fear the Branch - Marcus Bertrand

Everything is local

Page 51: Don't Fear the Branch - Marcus Bertrand

Merging is simple

Page 52: Don't Fear the Branch - Marcus Bertrand

Better workflows

Page 53: Don't Fear the Branch - Marcus Bertrand
Page 54: Don't Fear the Branch - Marcus Bertrand

• 2 Product Managers

• 1 Architect

• 1 Designer

• 2 QA

• 2 Team Leads

• Support, Tech Writing, Product Marketing & more!

• 30 Developers on 3 teams

• Red - Backend

• Blue - Front end

• Enterprise!

The Stash Team

Page 55: Don't Fear the Branch - Marcus Bertrand

Git Flow

Page 56: Don't Fear the Branch - Marcus Bertrand

Git Flow

m a s t e r

Page 57: Don't Fear the Branch - Marcus Bertrand

Git Flow

m a s t e r

f e a t u re / J R A - 1 2 3

Page 58: Don't Fear the Branch - Marcus Bertrand

Git Flow

m a s t e r

Md e v e l o p

f e a t u re / J R A - 1 2 3

Page 59: Don't Fear the Branch - Marcus Bertrand

Git Flow

m a s t e r

Md e v e l o p

M

f e a t u re / J R A - 1 2 3

Page 60: Don't Fear the Branch - Marcus Bertrand

Git Flow

m a s t e r

re l e a s e / 1 . 0

Md e v e l o p

M

f e a t u re / J R A - 1 2 3

Page 61: Don't Fear the Branch - Marcus Bertrand

Git Flow

m a s t e r

re l e a s e / 1 . 0

Md e v e l o p

M

f e a t u re / J R A - 1 2 3

1 . 0

Page 62: Don't Fear the Branch - Marcus Bertrand

Git Flow - bugfix

Page 63: Don't Fear the Branch - Marcus Bertrand

Git Flow - bugfix

re l e a s e / 1 . 0

Page 64: Don't Fear the Branch - Marcus Bertrand

Git Flow - bugfix

re l e a s e / 1 . 0

b u g f i x / J R A - 2 0 0

Page 65: Don't Fear the Branch - Marcus Bertrand

Git Flow - bugfix

M

1 . 1

re l e a s e / 1 . 0

b u g f i x / J R A - 2 0 0

Page 66: Don't Fear the Branch - Marcus Bertrand

Git Flow - bugfix

re l e a s e / 2 . 0 M

2 . 1

M

1 . 1

re l e a s e / 1 . 0

b u g f i x / J R A - 2 0 0

Page 67: Don't Fear the Branch - Marcus Bertrand

Git Flow - bugfix

m a s t e r M

re l e a s e / 2 . 0 M

2 . 1

M

1 . 1

re l e a s e / 1 . 0

b u g f i x / J R A - 2 0 0

Page 68: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

Page 69: Don't Fear the Branch - Marcus Bertrand

JIRA

Page 70: Don't Fear the Branch - Marcus Bertrand

Create Branch

Page 71: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

Page 72: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

f e a t u re / S TA S H D E V 0 7 3 6 9 …

Page 73: Don't Fear the Branch - Marcus Bertrand

Open a Pull Request

Page 74: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

f e a t u re / S TA S H D E V 0 7 3 6 9 …

M

Page 75: Don't Fear the Branch - Marcus Bertrand

Wait for the master build

Page 76: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

f e a t u re / S TA S H D E V 0 7 3 6 9 …

M

Page 77: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

f e a t u re / S TA S H D E V 0 7 3 6 9 …

M

re l e a s e / 1 . 0

Page 78: Don't Fear the Branch - Marcus Bertrand

Release manager

Page 79: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

f e a t u re / S TA S H D E V 0 7 3 6 9 …

Page 80: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

f e a t u re / S TA S H D E V 0 7 3 6 9 …

re l e a s e / 3 . 2

3 . 2

Page 81: Don't Fear the Branch - Marcus Bertrand

Stash flow

m a s t e r

f e a t u re / S TA S H D E V 0 7 3 6 9 …

re l e a s e / 3 . 2

3 . 2

M

Page 82: Don't Fear the Branch - Marcus Bertrand

Everyone is happy!

Page 83: Don't Fear the Branch - Marcus Bertrand

Almost

Page 84: Don't Fear the Branch - Marcus Bertrand

JIRA

Page 85: Don't Fear the Branch - Marcus Bertrand

Stash flow

b u g f i x / S TA H D E V- 1 2 3

re l e a s e / 3 . 0 M

re l e a s e / 3 . 1 M

m a s t e r M

Page 86: Don't Fear the Branch - Marcus Bertrand

Branch configuration

Page 87: Don't Fear the Branch - Marcus Bertrand
Page 88: Don't Fear the Branch - Marcus Bertrand
Page 89: Don't Fear the Branch - Marcus Bertrand
Page 90: Don't Fear the Branch - Marcus Bertrand

• 2 Product Managers

• 1 Architect

• 1 Designer

• 1QA

• 3 Team Leads

• Support, Tech Writing, Product Marketing & more!

• 1 TL and 3 Operations

• 15 Developers on 2 teams in Austin and San Francisco

• Backend

• Front end

!

The Bitbucket Team

Page 91: Don't Fear the Branch - Marcus Bertrand

Branch per feature

Page 92: Don't Fear the Branch - Marcus Bertrand

Branchper bug

Page 93: Don't Fear the Branch - Marcus Bertrand

Branch per hot fix

Page 94: Don't Fear the Branch - Marcus Bertrand

Branch

Page 95: Don't Fear the Branch - Marcus Bertrand

Branch per feature

s t a g i n g M

s t a g e _ 2 0 1 4 0 8 2 7 …

Page 96: Don't Fear the Branch - Marcus Bertrand

Branch per feature

m b e r t r a n d / B B - 1 2 3

s t a g i n g M

s t a g e _ 2 0 1 4 0 8 2 7 …

Page 97: Don't Fear the Branch - Marcus Bertrand

M

s t a g e _ 2 0 1 4 0 8 2 6 …

Branch per feature

m b e r t r a n d / B B - 1 2 3

s t a g i n g M

s t a g e _ 2 0 1 4 0 8 2 7 …

Page 98: Don't Fear the Branch - Marcus Bertrand

M

s t a g e _ 2 0 1 4 0 8 2 6 …

p ro d u c t i o n M

p ro d _ 2 0 1 4 0 8 2 6 …

Branch per feature

m b e r t r a n d / B B - 1 2 3

s t a g i n g M

s t a g e _ 2 0 1 4 0 8 2 7 …

Page 99: Don't Fear the Branch - Marcus Bertrand

Branch per feature

p ro d u c t i o n

Page 100: Don't Fear the Branch - Marcus Bertrand

Branch per feature

p ro d u c t i o n

m b e r t r a n d / B B - 1 2 3

Page 101: Don't Fear the Branch - Marcus Bertrand

Pull request

Page 102: Don't Fear the Branch - Marcus Bertrand

Comments

Page 103: Don't Fear the Branch - Marcus Bertrand

Branch per feature

p ro d u c t i o n

s t a g i n g M

m b e r t r a n d / B B - 1 2 3

j m o o / B B - 4 0 0

M

Page 104: Don't Fear the Branch - Marcus Bertrand

HipChat for Deployments

Page 105: Don't Fear the Branch - Marcus Bertrand

Branch per bug fix

s t a g i n g M

Page 106: Don't Fear the Branch - Marcus Bertrand

Branch per bug fix

s t a g i n g M

p ro d u c t i o n M

Page 107: Don't Fear the Branch - Marcus Bertrand

Branch per bug fix

s t a g i n g M

p ro d u c t i o n M

H O T F I X - B B - 5 0 0

Page 108: Don't Fear the Branch - Marcus Bertrand

Branch per bug fix

s t a g i n g M

p ro d u c t i o n M

M

H O T F I X - B B - 5 0 0

Page 109: Don't Fear the Branch - Marcus Bertrand

Branch per bug fix

s t a g i n g M

p ro d u c t i o n M M

M

H O T F I X - B B - 5 0 0

Page 110: Don't Fear the Branch - Marcus Bertrand
Page 111: Don't Fear the Branch - Marcus Bertrand

When things go wrong

Page 112: Don't Fear the Branch - Marcus Bertrand

What did I just merge?

Page 113: Don't Fear the Branch - Marcus Bertrand

Don’t panic

Page 114: Don't Fear the Branch - Marcus Bertrand

Unmerge

Page 115: Don't Fear the Branch - Marcus Bertrand

$ git revert {SHA1}

Page 116: Don't Fear the Branch - Marcus Bertrand

Mysteries

Page 117: Don't Fear the Branch - Marcus Bertrand

$ git log --all --stat --graph --parents

Page 118: Don't Fear the Branch - Marcus Bertrand

$ git show --pretty=raw --stat c102ec5

Page 119: Don't Fear the Branch - Marcus Bertrand

Branching==safety

Page 120: Don't Fear the Branch - Marcus Bertrand

Git branching==Freedom

Page 121: Don't Fear the Branch - Marcus Bertrand

Small changes==great success

Page 122: Don't Fear the Branch - Marcus Bertrand

atlassian.com/git

Page 123: Don't Fear the Branch - Marcus Bertrand

Thank you!

MARCUS BERTRAND • BITBUCKET DEVELOPER • @MARCUSBERTRAND


Top Related