Slide 1

Slide 1 text

Git The Git-Flow Model Foivos Zakkak [email protected] Except where otherwise noted, this presentation is licensed under the Creative Commons Attribution 4.0 International License. Third party marks and brands are the property of their respective holders.

Slide 2

Slide 2 text

Preamble Feel free to interrupt if you don’t understand something Please ask. There are no stupid questions! The slides are available at https://speakerdeck.com/zakkak/git-flow Apologies in advance if I inadvertently offend you in any way Git: The Git-Flow Model [email protected]

Slide 3

Slide 3 text

Assumptions You know how to: create a new repository git init clone git clone pull git pull commit git add ; git commit push git push use branches git branch mybranch; git checkout mybranch Git: The Git-Flow Model [email protected]

Slide 4

Slide 4 text

What Is This Talk About? The most popular Git branching model! Git: The Git-Flow Model [email protected]

Slide 5

Slide 5 text

What is a Git branching model? A methodology defining: a number of standard branches when to create new branches when and how to merge branches when to create new tags Git: The Git-Flow Model [email protected]

Slide 6

Slide 6 text

The Standard Branches master for production releases develop for “next release” development No coding on these branches only merges ©Vincent Driessen Git: The Git-Flow Model [email protected]

Slide 7

Slide 7 text

Supporting Branches feature/* for new features release/* for new releases hotfix/* for fast/critical patches Git: The Git-Flow Model [email protected]

Slide 8

Slide 8 text

Feature Branches ©Vincent Driessen Git: The Git-Flow Model [email protected]

Slide 9

Slide 9 text

Feature Branches ©Vincent Driessen 1. git checkout develop -b feature/mynewfeature Git: The Git-Flow Model [email protected]

Slide 10

Slide 10 text

Feature Branches ©Vincent Driessen 1. git checkout develop -b feature/mynewfeature 2. Code and git commit Git: The Git-Flow Model [email protected]

Slide 11

Slide 11 text

Feature Branches ©Vincent Driessen 1. git checkout develop -b feature/mynewfeature 2. Code and git commit 3. git checkout develop Git: The Git-Flow Model [email protected]

Slide 12

Slide 12 text

Feature Branches ©Vincent Driessen 1. git checkout develop -b feature/mynewfeature 2. Code and git commit 3. git checkout develop 4. git merge --no-ff feature/mynewfeature Git: The Git-Flow Model [email protected]

Slide 13

Slide 13 text

Feature Branches ©Vincent Driessen 1. git checkout develop -b feature/mynewfeature 2. Code and git commit 3. git checkout develop 4. git merge --no-ff feature/mynewfeature 5. git branch -d feature/mynewfeature Git: The Git-Flow Model [email protected]

Slide 14

Slide 14 text

Feature Branches ©Vincent Driessen 1. git checkout develop -b feature/mynewfeature 2. Code and git commit 3. git checkout develop 4. git merge --no-ff feature/mynewfeature 5. git branch -d feature/mynewfeature 6. git push Git: The Git-Flow Model [email protected]

Slide 15

Slide 15 text

Release Branches ©Vincent Driessen Git: The Git-Flow Model [email protected]

Slide 16

Slide 16 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 Git: The Git-Flow Model [email protected]

Slide 17

Slide 17 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit Git: The Git-Flow Model [email protected]

Slide 18

Slide 18 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit 3. git checkout master Git: The Git-Flow Model [email protected]

Slide 19

Slide 19 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit 3. git checkout master 4. git merge --no-ff release/v2.1.0 Git: The Git-Flow Model [email protected]

Slide 20

Slide 20 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit 3. git checkout master 4. git merge --no-ff release/v2.1.0 5. git tag -a v2.1.0 Git: The Git-Flow Model [email protected]

Slide 21

Slide 21 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit 3. git checkout master 4. git merge --no-ff release/v2.1.0 5. git tag -a v2.1.0 6. git push --tags Git: The Git-Flow Model [email protected]

Slide 22

Slide 22 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit 3. git checkout master 4. git merge --no-ff release/v2.1.0 5. git tag -a v2.1.0 6. git push --tags 7. git checkout develop Git: The Git-Flow Model [email protected]

Slide 23

Slide 23 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit 3. git checkout master 4. git merge --no-ff release/v2.1.0 5. git tag -a v2.1.0 6. git push --tags 7. git checkout develop 8. git merge --no-ff release/v2.1.0 Git: The Git-Flow Model [email protected]

Slide 24

Slide 24 text

Release Branches ©Vincent Driessen 1. git checkout develop -b release/v2.1.0 2. Bump version to 2.1.0 and git commit 3. git checkout master 4. git merge --no-ff release/v2.1.0 5. git tag -a v2.1.0 6. git push --tags 7. git checkout develop 8. git merge --no-ff release/v2.1.0 9. git branch -d release/v2.1.0 Git: The Git-Flow Model [email protected]

Slide 25

Slide 25 text

Hotfix Branches ©Vincent Driessen Git: The Git-Flow Model [email protected]

Slide 26

Slide 26 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 Git: The Git-Flow Model [email protected]

Slide 27

Slide 27 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit Git: The Git-Flow Model [email protected]

Slide 28

Slide 28 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit Git: The Git-Flow Model [email protected]

Slide 29

Slide 29 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit 4. git checkout master Git: The Git-Flow Model [email protected]

Slide 30

Slide 30 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit 4. git checkout master 5. git merge --no-ff hotfix/v2.1.1 Git: The Git-Flow Model [email protected]

Slide 31

Slide 31 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit 4. git checkout master 5. git merge --no-ff hotfix/v2.1.1 6. git tag -a v2.1.1 Git: The Git-Flow Model [email protected]

Slide 32

Slide 32 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit 4. git checkout master 5. git merge --no-ff hotfix/v2.1.1 6. git tag -a v2.1.1 7. git checkout develop or release/vX.X.0 Git: The Git-Flow Model [email protected]

Slide 33

Slide 33 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit 4. git checkout master 5. git merge --no-ff hotfix/v2.1.1 6. git tag -a v2.1.1 7. git checkout develop or release/vX.X.0 8. git merge --no-ff hotfix/v2.1.1 Git: The Git-Flow Model [email protected]

Slide 34

Slide 34 text

Hotfix Branches ©Vincent Driessen 1. git checkout master -b hotfix/v2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit 4. git checkout master 5. git merge --no-ff hotfix/v2.1.1 6. git tag -a v2.1.1 7. git checkout develop or release/vX.X.0 8. git merge --no-ff hotfix/v2.1.1 9. git branch -d hotfix/v2.1.1 Git: The Git-Flow Model [email protected]

Slide 35

Slide 35 text

©Vincent Driessen

Slide 36

Slide 36 text

Making it less cumbersome Debian-based Linux apt-get install git-flow Mac OSX brew install git-flow-avh or port install git-flow-avh Others See https://github.com/nvie/gitflow/wiki/Installation Git: The Git-Flow Model [email protected]

Slide 37

Slide 37 text

Initialize git flow init Git: The Git-Flow Model [email protected]

Slide 38

Slide 38 text

Feature Branches ©Vincent Driessen 1. git flow feature start mynewfeature 2. Code and git commit 3. git flow feature finish --push Git: The Git-Flow Model [email protected]

Slide 39

Slide 39 text

Feature Branches ©Vincent Driessen 1. git flow feature start mynewfeature 2. Code and git commit 3. git flow feature finish --push Shared feature branches: git flow feature publish coopfeature git flow feature pull origin coopfeature Git: The Git-Flow Model [email protected]

Slide 40

Slide 40 text

Release Branches ©Vincent Driessen 1. git flow release start 2.1.0 2. Bump version to 2.1.0 and git commit 3. git flow release publish 2.1.0 4. Fix bugs (only) and git commit 5. git flow release finish 2.1.0 --push 6. git push --tags Git: The Git-Flow Model [email protected]

Slide 41

Slide 41 text

Hotfix Branches ©Vincent Driessen 1. git flow hotfix start 2.1.1 2. Bump version to 2.1.1 and git commit 3. Apply hot fix and git commit 4. git flow hotfix finish 2.1.1 --push 5. git push --tags Git: The Git-Flow Model [email protected]

Slide 42

Slide 42 text

What about code reviews? 1. git flow feature/release/hotfix start ID 2. Edit and git commit 3. git flow feature/release/hotfix publish ID 4. Open Pull/Merge Request on github/gitlab 5. When the Pull/Merge Request gets approved 6. git flow feature/release/hotfix finish --keepremote --push ID 7. git push --tags (for release and hotfix) 8. Delete branch from github merged pull request Git: The Git-Flow Model [email protected]

Slide 43

Slide 43 text

Hint To avoid flags --keepremote --push ID : git config gitflow.feature.finish.keepremote true git config gitflow.feature.finish.push true git config gitflow.hotfix.finish.keepremote true git config gitflow.hotfix.finish.push true git config gitflow.release.finish.keepremote true git config gitflow.release.finish.push true Git: The Git-Flow Model [email protected]

Slide 44

Slide 44 text

Acknowledgments Git-flow was first presented by Vincent Driessen in 2010. For the original post visit http://nvie.com/posts/a-successful-git-branching-model/ Git: The Git-Flow Model [email protected]

Slide 45

Slide 45 text

Cheers! Git The Git-Flow Model Foivos Zakkak [email protected]