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

Real World Git Workflows

Real World Git Workflows

Jazoon 2013 presentation

Stefan Saasen

October 23, 2013
Tweet

More Decks by Stefan Saasen

Other Decks in Programming

Transcript

  1. git

  2. Cheap local branching Full local history Speed Staging area prominent

    in Open Source Huge community You heard has Superior Merging Much faster than svn Distributed cryptographic integrity
  3. RELEASE Can we fix a bug for a specific ?

    FEATURE Is the code for that complete? BUILD Can we the current code ? REVIEWED Has everybody the code for this feature ? HOTFIX Can we do a fast for the current release?
  4. Fully decentralized Anarchy I do my thing I do my

    thing, too ANARCHY here’s mine, who tells john? look ma, a goat!
  5. Time master/ production staging feature master is in production staging

    is the next version new features off staging with branch names like: username/ISSUE-KEY-summary promoted from staging, can receive hotfixes Hotfix PR
  6. Significant branches map to a concept in the outside world.

    It may be a past release, an environment or a role. Those branches are long-running and stable whereas feature branches are short lived and volatile. Me, just making this up. ” “
  7. Central Repository 1 One Branch per Feature One Branch per

    Bugfix 2 3 Time master feature branches PRJ-123-description Time master bugfix branch PRJ-123-bug-description Short lived
  8. Release Branches 4 master is alpha / RC 5 Long

    running Time master release branch PRJ-345-bug-description bugfix 2.2
  9. release branch 2.2 release branch 2.1 2.1.4 2.2.1 We don’t

    want to merge the 2.1.x version! 2.1.5-SNAPSHOT What can we do here?
  10. stable branch 2.2 stable branch 2.1 2.1.4 2.2.1 2.1.5-SNAPSHOT merge

    commit, content discarded $> git checkout stable-2.2 $> git merge -s ours stable-2.1
  11. The merge protocol The secret sauce When a branch is:

    Change flows from branch to baseline: Change flows from baseline to branch: More stable than its baseline Less stable than its baseline Continually Never When code complete When necessary Release branch Feature branches Credit: Laura Wingerd - The Flow of change
  12. The merge protocol The secret sauce Release Branch Master Merge

    continually Backport single changes using git cherry-pick Never merge!
  13. Hey I have some code I want to merge here,

    take a look? Low friction collaboration Pull Request I have some code here! Can I merge it here?
  14. Every one has their remote repository With Forks Full remote

    copy, each has one Integrator, Gatekeeper, Tech Lead, etc.
  15. Complete visibility 1 No per Dev remotes required KISS 2

    3 Pros of a Single Repo All feature branches available
  16. FORKING IN THE ENTERPRISE 4 Reasons for... REASON 1 Great

    for customizing libraries and still get bug fixes
  17. REASON 4 Reduce the noise and keep the overview for

    huge projects FORKING IN THE ENTERPRISE
  18. Hooks are little scripts you can place in the `$GIT_DIR/hooks`

    directory to trigger action at certain points. – githooks Documentation ” “
  19. $ git checkout master master is lookin'good! c4f3b4b has 4

    green builds. $ git checkout stable-2.3 DANGER! stable-2.3 is busted. e1324fa has 2 red builds.
  20. 1 An explosion of branches 2 3 Performance degradation of

    build sys Building everything is expensive
  21. Branching Model Adopt Git Practices Automation & CI setup Conclusions

    Product workflow Continuous delivery workflow Embrace PR Build automatically, but leave knobs! Single Repo or Forks Collaboration Model Centralized Hooks, hooks everywhere Merge protocol