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

Git: The Pain and the Gain

Git: The Pain and the Gain

Justin Yost

July 28, 2018
Tweet

More Decks by Justin Yost

Other Decks in Programming

Transcript

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

    Engineer Wirecutter CC BY-NC 4.0 Justin Yost 1
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. Gitflow — Super strict branching model — Master, Develop, Feature,

    Release and Hotfix Branches CC BY-NC 4.0 Justin Yost 11
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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