Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git Flow

zakkak
January 16, 2018

Git Flow

zakkak

January 16, 2018
Tweet

More Decks by zakkak

Other Decks in Programming

Transcript

  1. 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.
  2. 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]
  3. Assumptions You know how to: create a new repository git

    init clone git clone <path.to.git.repository> pull git pull commit git add <file>; git commit push git push use branches git branch mybranch; git checkout mybranch Git: The Git-Flow Model [email protected]
  4. 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]
  5. 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]
  6. Supporting Branches feature/* for new features release/* for new releases

    hotfix/* for fast/critical patches Git: The Git-Flow Model [email protected]
  7. 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]
  8. 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]
  9. 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]
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. 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]
  15. 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]
  16. 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]
  17. 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]
  18. 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]
  19. 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]
  20. 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]
  21. 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]
  22. 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]
  23. 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]
  24. 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]
  25. 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]
  26. 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]
  27. 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]
  28. 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]
  29. 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]
  30. 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]
  31. 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]
  32. 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]
  33. 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]
  34. 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]