real world git workflows
play

Real world Git workflows TODO Show of hands Picture with - PowerPoint PPT Presentation

Real world Git workflows TODO Show of hands Picture with hands/lighter/concert Stefan Saasen Atlassian Stash Development Lead Stefan Saasen Atlassian Stash Development Lead @stefansaasen You heard is on the rise 38% 15% from 2011


  1. Real world Git workflows

  2. TODO Show of hands � Picture with hands/lighter/concert

  3. Stefan Saasen Atlassian Stash Development Lead

  4. Stefan Saasen Atlassian Stash Development Lead @stefansaasen

  5. You heard is on the rise 38% 15% from 2011 to 2013 Source: RedMonk Git Survey 2013

  6. You heard has Cheap local branching Full local history Much faster than svn Staging area Huge community Speed Superior Merging prominent in Open Source Distributed cryptographic integrity

  7. We’ll cover:

  8. We’ll cover: Collaboration model 1

  9. We’ll cover: Collaboration model 1 Branching model 2

  10. We’ll cover: Collaboration model 1 Branching model 2 Practices 3

  11. Which collaboration model? 1

  12. Slide Title

  13. ANARCHY Fully decentralized Anarchy

  14. I do my thing, too I do my thing ANARCHY here’ s mine, who tells look ma, a goat! john? Fully decentralized Anarchy

  15. Gatekeeper Blessed repository with Gatekeeper

  16. He is cool Gatekeeper Blessed repository with Gatekeeper To have your work accepted, talk to him

  17. Dictator and Lieutenants

  18. Dictator and Lieutenants Blessed repository long live the King! Lieutenants guard the King

  19. Centralised Shared common repository

  20. Centralised Shared common repository we share “everything”

  21. +

  22. + Enterprise

  23. = Centralized + Enterprise

  24. Metrics Issues Builds Deployments

  25. Metrics Issues Builds They know where the code needs to go! Deployments

  26. Which branching model?

  27. Which branching model? 2

  28. Can we still fix a bug for the upcoming Release ?

  29. Can we still fix a bug for the upcoming Release ? Is the code for that Feature complete?

  30. Hotfix How do we do a Can we still fix a bug for the upcoming Release ? for the current version? Is the code for that Feature complete?

  31. Hotfix How do we do a Can we still fix a bug for the upcoming Release ? for the current version? Is the code for that Feature Reviewed Has everyone complete? the code for this feature ?

  32. What’s the best Git workflow?

  33. We don’ t know! What’s the best Git workflow?

  34. What’s the best Git workflow? di ff erent cultures

  35. What’s the best Git workflow? di ff erent cultures + di ff erent products

  36. What’s the best Git workflow? di ff erent cultures + di ff erent products + di ff erent teams

  37. What’s the best Git workflow? di ff erent cultures + di ff erent products + di ff erent teams = di ff erent workflows

  38. Design your own Workflows

  39. 1. Single branch workflow - aka trunk

  40. Committing locally Local Repository Master

  41. Committing locally Local Repository Master

  42. Central repository has updates Master Central Repository Local Repository Master

  43. Getting updates via rebase Master Central Repository Local Repository Master

  44. Getting updates via rebase Master Central Repository Local Repository Master

  45. 2. Feature branching workflow

  46. Creating a branch master

  47. Creating a branch master Feature #1

  48. Adding changes master Feature #1

  49. Merge master m Feature #1

  50. Working on features in parallel Feature #2 master m Feature #1

  51. Working on features in parallel Feature #2 master m Feature #1

  52. Suboptimal way Feature #2 m e l b i s s o p master m f i s i h t d Feature #1 i o v a

  53. Suboptimal way e Feature #2 m l b i s s o p f m master m i s i h t d i o Feature #1 v a

  54. A better way using rebase Feature #2 master m Feature #1

  55. Working on features in parallel m Feature #2 m master m Feature #1

  56. Working on features in parallel m Feature #2 m master m Feature #1

  57. Working on features in parallel m Feature #2 m master m Feature #1 •Always with local branches

  58. Working on features in parallel m Feature #2 m master m Feature #1 •Always with local branches •With shared branches: After review, before merging

  59. Working on features in parallel m Feature #2 m master m Feature #1 •Always with local branches •With shared branches: After review, before merging •Mostly a non-issue for short lived branches when updates from master are not required

  60. 3. Continuous delivery workflow

  61. master is in production 1

  62. promoted from staging, can receive hot-fixes master is in production 1

  63. promoted from staging, can receive hot-fixes master is in production 1 staging is the next version 2

  64. promoted from staging, can receive hot-fixes master is in production 1 staging is the next version 2 new features o ff staging 3

  65. promoted from staging, can receive hot-fixes master is in production 1 staging is the next version 2 new features o ff staging 3 with branch names like: username/ISSUE-KEY-summary

  66. 3. Continuous delivery workflow feature-1 m staging master

  67. 3. Continuous delivery workflow feature-1 feature-2 m m m staging master

  68. 3. Continuous delivery workflow feature-1 feature-2 m m m staging m master

  69. 3. Continuous delivery workflow feature-1 feature-2 m m m staging m master H R

  70. 3. Continuous delivery workflow feature-1 feature-2 m m m staging m master H R release to production = merge master In Production

  71. 3. Continuous delivery workflow only merges feature-1 feature-2 m m m staging m master H R release to production = merge master In Production

  72. 4. Product releases workflow

  73. one branch per feature 1

  74. one branch per feature 1 one branch per bugfix 2

  75. one branch per feature 1 one branch per bugfix 2 long running stable branches 3

  76. one branch per feature 1 one branch per bugfix 2 long running stable branches 3 master is alpha/RC status 4

  77. it’s just a normal branching workflow… feature-1 feature-2 master

  78. with long running release branches feature-1 feature-2 master 2.2 2.1 bugfix

  79. Bugfix Merge Master 2.2 2.1 Bugfix

  80. Merge into 2.1 Master 2.2 2.1 Bugfix

  81. Merge into 2.2 Master 2.2 2.1 Bugfix

  82. Merge into Master Master 2.2 2.1 Bugfix

  83. Automatically merging release branches Master 2.2 2.1 Bugfix

  84. Automatically merging release branches Master 2.2 2.1 Bugfix Automatic MERGES!

  85. Automatically merging release branches 2.1.4 2.1.5-SNAPSHOT We don’ t want to merge the 2.1.x version! 2.2 2.1 Bugfix

  86. git merge --strategy= resolve

  87. git merge --strategy= recursive

  88. git merge --strategy=

  89. git merge --strategy= ours

  90. Automatically merging release branches 2.1.4 2.1.5-SNAPSHOT 2.2 2.1 Bugfix $> git checkout stable-2.2 $> git merge -s ours stable-2.1

  91. Automatically merging release branches merge commit, content discarded 2.2 2.1 Bugfix $> git checkout stable-2.2 $> git merge -s ours stable-2.1

  92. overall picture feature-1 feature-2 master 2.2 2.1 bugfix

  93. Deep breath, it’s really simple

Recommend


More recommend