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

A Sane git Workflow

A Sane git Workflow

(for the fairly advanced git user who can’t quite 
use github’s awesome continuous deployment
 methodology because they still have to deal
 with versions and releases and other
 business / marketing nonsense)

This was the original concept for Vitrue's git workflow, and includes a few slides about getting rid of the old "git-flow". A newer version of this presentation is now the one I use for new teams here a Vitrue (or as we're now known, Oracle).

Elliott Wood

March 21, 2012
Tweet

More Decks by Elliott Wood

Other Decks in Programming

Transcript

  1. a sane git workflow (for the fairly advanced git user

    who can’t quite use github’s awesome continuous deployment methodology because they still have to deal with versions and releases and other business / marketing nonsense)
  2. PROCESS PROCESS PROCESS P OCESS PROCESS PROCESS PROC PROCESS PROCESS

    PROCESS PR Do I need to merge twice? How do I resolve this conflict? Where do I merge?
  3. PROCESS PROCESS PROCESS P OCESS PROCESS PROCESS PROC PROCESS PROCESS

    PROCESS PR WTF is going on? Do I need to merge twice? How do I resolve this conflict? Where do I merge?
  4. WHAT WE NEED simple prevent merge errors & regressions consistency

    keep everyone working on the latest code as often as possible
  5. START SANE, STAY SANE master == develop If it doesn’t,

    figure out why not! Unmerged features? Probably need to break these out. If all else fails, rename develop to something else and start clean
  6. git fetch git checkout origin/develop git checkout -b old-develop git

    push origin old-develop git checkout develop git reset --hard origin/master git push -f origin develop
  7. USE:feature branches branch from develop when you start a new

    feature rebase onto develop often stay up to date with the latest and greatest pull request into develop when done
  8. NO!release branches develop is your release branch nothing merges into

    develop until it is ready to release you can’t release until everything in develop is ready new features branch from, and merge back into, develop
  9. interlude on pull requests: after the pull request, the branch

    is done no more commits! avoid confusion delete the branch
  10. interlude on pull requests: after the pull request, the branch

    is done no more commits! avoid confusion delete the branch, or fast-forward to the merged branch
  11. REBASE stay on top of the latest changes incorporate others’

    work into your own branch don’t fear the
  12. REBASE fear not the stay on top of the latest

    changes incorporate others’ work into your own branch two developers working on the same feature branch may depend on each other’s progress abstract one more level
  13. things to note: no shared branches rebase at will fewer

    pull/merge conflicts merge code when it won’t break others’ your branch back to feature branch feature branch back to develop all merging done by github code reviews! if github can’t merge, rebase! less likely to resolve conflicts incorrectly
  14. things to note: • no shared branches • rebase at

    will • fewer pull/merge conflicts • merge code when it won’t break others’ • your branch back to feature branch • feature branch back to develop • all merging done by github • code reviews! • if github can’t merge, rebase! less likely to resolve conflicts incorrectly!!
  15. STOP!with the bad habits the straight line myth is dead

    you’ll have lots of branches merges are not evil use GUIs sparingly this is code, not a pretty picture git pull is evil git fetch, followed by git merge
  16. NO!staging branch staging is a tag any developer can tag

    staging and deploy their code there final qa before release? merge features into develop and tag staging there
  17. develop kb/moar ew/new-shiny git tag -f staging git push -f

    origin staging on branch kb/moar: staging
  18. develop kb/moar ew/new-shiny git tag -f staging git push -f

    origin staging on branch kb/moar: staging
  19. PUSH IT! release management hotfixes on master pull request from

    develop to master fast-forward develop to master (branches end after merge) tag your release v2.1.5
  20. ew/hotfix develop master jl/new git rebase origin/master git tag -f

    staging on branch develop: staging kb/hotness v2.1.1 v2.1.0
  21. ew/hotfix master, develop jl/new git branch -d develop git checkout

    -b develop on branch master: kb/hotness v2.2.0 v2.1.1 v2.1.0
  22. REVIEW master == develop feature branches from develop don’t share

    branches! pull request back to develop rebase to stay current hotfix branches from master pull request back to master branches end after merge