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

Git: The Pain and the Gain

Git: The Pain and the Gain

5485e66eefca3e321e605c56157514c4?s=128

Justin Yost

July 28, 2018
Tweet

Transcript

  1. Git: The Pain and the Gain Justin Yost Senior Software

    Engineer Wirecutter CC BY-NC 4.0 Justin Yost 1
  2. Git — Distributed Version Control System — Lots of fun

    CC BY-NC 4.0 Justin Yost 2
  3. Git — Branching - creating a new branch to do

    work in — Merging - making two branches one — Rebasing - reapply commits from one branch on top of another CC BY-NC 4.0 Justin Yost 3
  4. Git Workflows — Patterns to use Git in a team

    wide manner to achieve some goal — Everyone's Git workflow can be and is different — The Git workflow that works for you is the one that works CC BY-NC 4.0 Justin Yost 4
  5. Git Workflows — That all being said let's explore some

    of the more common patterns — What does each do really well — What does each do not so well CC BY-NC 4.0 Justin Yost 5
  6. Git as SVN — One branch (master) — Pushes means

    everyone has to rebase or pull in their new work ontop of others work — Pushes can't be held to be reviewed — It's SVN but it's Git CC BY-NC 4.0 Justin Yost 6
  7. Git as SVN git commit && git push git rebase

    CC BY-NC 4.0 Justin Yost 7
  8. Git as SVN: Upsides — Branching can be complicated, it's

    not always easy — Are you just learning Git and coming from SVN or CVS? — Do you not do code reviews? — Are you working alone? CC BY-NC 4.0 Justin Yost 8
  9. Git as SVN: Downsides — Branching is really cheap in

    Git — Are you going to keep using Git in the future? — Do you really not want to do code reviews? — Are you working on a team? CC BY-NC 4.0 Justin Yost 9
  10. Demo CC BY-NC 4.0 Justin Yost 10

  11. Gitflow — Super strict branching model — Master, Develop, Feature,

    Release and Hotfix Branches CC BY-NC 4.0 Justin Yost 11
  12. Time release branches master develop hotfixes feature branches Feature for

    future release Tag 1.0 Major feature for next release From this point on, “next release” means the release after 1.0 Severe bug fixed for production: hotfix 0.2 Bugfixes from rel. branch may be continuously merged back into develop Tag 0.1 Tag 0.2 Incorporate bugfix in develop Only bugfixes! Start of release branch for 1.0 Author: Vincent Driessen Original blog post: http://nvie.com/posts/a-succesful-git-branching-model License: Creative Commons BY-SA CC BY-NC 4.0 Justin Yost 12
  13. Gitflow git checkout -b git merge --no-ff CC BY-NC 4.0

    Justin Yost 13
  14. Gitflow — https://danielkummer.github.io/git-flow- cheatsheet/index.html git flow feature/release/hotfix start/finish/publish/pull [name] CC

    BY-NC 4.0 Justin Yost 14
  15. Gitflow: Upsides — It's formulaic — Interruptions are cheap —

    Collaborate on your features — Master is always what is on production — Develop is always ready to set for a release — Hotfixes are a first class citizen CC BY-NC 4.0 Justin Yost 15
  16. Gitflow: Downsides — It's formulaic — Interruptions are cheap —

    Feature branches just can live out there forever — Easy to look at the idea of the pattern of what happened, harder to explain what happened (spaghetti branches) CC BY-NC 4.0 Justin Yost 16
  17. Demo CC BY-NC 4.0 Justin Yost 17

  18. Git Feature Branches — Somewhere in-between the two — Master,

    Develop, (typically short lived) Feature Branches — Branch for features, merge (somehow) into develop for deploys CC BY-NC 4.0 Justin Yost 18
  19. Git Feature Branches git checkout -b git merge --squash/--no-ff/--ff CC

    BY-NC 4.0 Justin Yost 19
  20. Git Feature Branches (Upsides) — Doing work, create a branch

    — No rules, make your own — How you merge is up to your team CC BY-NC 4.0 Justin Yost 20
  21. Git Feature Branches (Downsides) — It's as easy and as

    complicated as you want it to be — No rules, so figure it all out — What happens when work requires other past work not yet merged? — Straight merge, merge and rebase, merge and squash, it's all up to you CC BY-NC 4.0 Justin Yost 21
  22. Demo CC BY-NC 4.0 Justin Yost 22

  23. Merging Sidebar — Merges only - you get the truth

    of what happened — Rebase and Merge - get the edited version of what happened — Squash and Merge - get only the final versions without the metadata of the changes CC BY-NC 4.0 Justin Yost 23
  24. Demo CC BY-NC 4.0 Justin Yost 24

  25. Git Workflows — There is no right solution — It's

    what works for you and your team — Different solutions have different problems and benefits — The size and scope and every team's problems, comfort with Git, desired outcomes, is different CC BY-NC 4.0 Justin Yost 25
  26. Thanks Questions? — twitter.com/justinyost — github.com/justinyost — justinyost.com — linkedin.com/learning/instructors/justin-yost

    — https://joind.in/talk/94ea1 CC BY-NC 4.0 Justin Yost 26