Slide 1

Slide 1 text

Git: The Pain and the Gain Justin Yost Senior Software Engineer Wirecutter CC BY-NC 4.0 Justin Yost 1

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

Git as SVN git commit && git push git rebase CC BY-NC 4.0 Justin Yost 7

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

Demo CC BY-NC 4.0 Justin Yost 10

Slide 11

Slide 11 text

Gitflow — Super strict branching model — Master, Develop, Feature, Release and Hotfix Branches CC BY-NC 4.0 Justin Yost 11

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Gitflow git checkout -b git merge --no-ff CC BY-NC 4.0 Justin Yost 13

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

Demo CC BY-NC 4.0 Justin Yost 17

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

Git Feature Branches git checkout -b git merge --squash/--no-ff/--ff CC BY-NC 4.0 Justin Yost 19

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

Demo CC BY-NC 4.0 Justin Yost 22

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

Demo CC BY-NC 4.0 Justin Yost 24

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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