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

Advanced Branch Management Techniques @PhpCluj

Advanced Branch Management Techniques @PhpCluj

Georgiana Gligor

April 13, 2016
Tweet

More Decks by Georgiana Gligor

Other Decks in Technology

Transcript

  1. @gbtekkie PHP Cluj Meetup | APRILIE 2016 Georgiana Gligor ✓

    Geek. Mother. Do-er. ✓ Enterprise applications development since 2003 ✓ Architecture & DevOps consultant ✓ PHP Cluj Meetup Organizer
  2. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ develops new

    features ✓ alters existing code ✓ makes frequent commits (checkpoint commits) DEVELOPER
  3. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ checks existing

    functionalities ✓ dedicated QA / developers practicing BDD TESTER
  4. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ finds root

    cause of a problem ▸ reproduces the problem ▸ detects cauze ▸ separates causing change ✓ commit history needs to be clean, 1 commit = 1 logical aspect BUG HUNTER
  5. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ prepares the

    software package ▸ cod (functionality) ▸ dependencies ▸ application configuration PACKAGE BUILDER
  6. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ creates the

    system on which the software package will be deployed ✓ configures the system ✓ installs software package DEPLOYER
  7. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ reviews code

    ✓ executes merge action (integration) ✓ runs any necessary checks (functionality, deploy in a controlled environment, etc) INTEGRATOR
  8. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ 1 branch

    ephemeral branch per topic ✓ many small changes TOPIC BRANCH
  9. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ used to

    create releases ✓ corresponds to the most stable code version STABLE TRUNK
  10. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ no guarantee

    that the master code is stable ✓ some commits are chosen for the release UNSTABLE TRUNK
  11. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ team works

    in parallel on topic branches ✓ what goes in the release is decided separately INTEGRATION PIPELINES
  12. @gbtekkie PHP Cluj Meetup | APRILIE 2016 # starting the

    topic branch, which may be public $ git checkout -b 025-merge-workflow $ git commit -m “introduced explanatory section in readme” # commit some changes $ git commit -m “new useful articles section” $ git push origin 025-merge-workflow Work on topic branch
  13. @gbtekkie PHP Cluj Meetup | APRILIE 2016 # changes happen

    on the mainline $ git checkout master $ git commit -m “improved explanatory opening paragraph" $ git push origin master # grab latest from mainline $ git checkout 025-merge-workflow $ git pull origin master # might need conflict solving $ git push origin 025-merge-workflow Mainline
  14. @gbtekkie PHP Cluj Meetup | APRILIE 2016 # integrate the

    topic branch $ git checkout master $ git pull origin master $ git merge 025-merge-workflow Updating c328fbb..8c3315d Fast-forward README.md | 7 +++++++ 1 file changed, 7 insertions(+) $ git status On branch master Your branch is ahead of 'origin/master' by 3 commits. (use "git push" to publish your local commits) nothing to commit, working directory clean $ git push origin master Integrate
  15. @gbtekkie PHP Cluj Meetup | APRILIE 2016 # work on

    a local topical branch, single change $ git checkout -b 02-rebase-workflow $ git commit -m “added explanatory paragraph” # do NOT push to remote! # other things are published on master $ git checkout master $ git commit -m “added series notice” $ git push origin master Work on topic branch
  16. @gbtekkie PHP Cluj Meetup | APRILIE 2016 # we rebase

    the topical branch single change on the master branch $ git fetch origin $ git rebase origin/master $ git checkout master $ git rebase 02-rebase-workflow First, rewinding head to replay your work on top of it... Fast-forwarded master to 02-rebase-workflow. $ git push Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 337 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) To [email protected]:tekkie/git-rebase-workflow.git 5817048..c63367b master -> master Rebase
  17. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ stable trunk

    approach, frequent production deploys ✓ public topic branches GitHub Flow
  18. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ similar to

    GitHub Flow ✓ topic branches are rebased from master frequently during their lifetime ✓ pull requests integrated back with explicit merge Atlassian Simple Git Workflow
  19. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ stable trunk

    approach, frequent production deploys ✓ public topic branches GitLab Flow
  20. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ Download Git

    ✓ Git merge documentation ✓ Git rebase documentation ✓ Git merge workflow sample repository ✓ Git rebase workflow sample repository Related Links
  21. @gbtekkie PHP Cluj Meetup | APRILIE 2016 ✓ Guide to

    Enterprise PHP Development ✓ Lorna Jane’s branching strategy presentation ✓ A Rebase-based workflow ✓ Git team workflows: merge or rebase? ✓ Understanding the Git Workflow ✓ Linus on clean history ✓ gitworkflows ✓ GitHub Flow ✓ Atlassian Simple Git Workflow ✓ GitLab Flow ✓ Git Flow ✓ Atlassian series on Git ✓ Trunk-based Development ✓ Symfony framework release process Recommended Reading