advertisement

Never Commit to Master: An Introduction to Git Flow

50 %
50 %
advertisement
Information about Never Commit to Master: An Introduction to Git Flow
Technology

Published on March 3, 2014

Author: opdavies

Source: slideshare.net

Description

My session, "Never Commit to Master" (originally just called "What is Git Flow?"), from DrupalCamp London 2014.
advertisement

Never Commit to Master An Introduction to Git Flow By Oliver Davies / @opdavies

Me Oliver Davies Developer and Systems Administrator @opdavies (Twitter, D.O., IRC) http://dgo.to/@opdavies PHPer and Drupalista since 2007 (full time since 2010) Git user since 2010 Git Flow user since 2013

Git Flow is: "A collection of Git extensions to provide high-level repository operations for Vincent Driessen's branching model." From https://github.com/nvie/gitflow

The Branching Model

Branches m s e : production code atr d v l p development code eeo: f a u e : a specific task or ticket (multiple) etr/ r l a e : temporary release branch for testing (single) ees/ h t i / temporary branch for emergency fixes ofx: s p r / experimental uot:

Why use Git Flow? Separation of production and development code Flexibility Better code quality Encourages collaboration Encourages peer code reviews

My rules of Git Flow 1. 2. 3. 4. 5. Never, ever commit code directly to m s e atr Only commit stable code to d v l p eeo Try not to commit directly to d v l p eeo One feature branch per user story/bug Commit early, commit often, push often

How do I use it? CLI ~$be isalgtfo rw ntl i-lw ~$atgtisalgtfo p-e ntl i-lw ~$ymisalgtlw u ntl ifo SourceTree (free, cross-platform GUI)

Need Help? ~$gtfo hl i lw ep #Sostesadr hl mn hw h tnad ep eu ~$gtfo {ucmad hl i lw sbomn} ep #Sostehl mn fraseii sbomn hw h ep eu o pcfc ucmad

Initialise Git Flow ~$gtfo ii i lw nt

Create your default branches ~$gtfo ii i lw nt N bace eityt Bs bace ms b cetdnw o rnhs xs e. ae rnhs ut e rae o. Bac nm frpouto rlae:[atr rnh ae o rdcin eess mse] Bac nm fr"etrlae dvlpet [eeo] rnh ae o nx ees" eeomn: dvlp

Configure branch prefixes ~$gtfo ii i lw nt N bace eityt Bs bace ms b cetdnw o rnhs xs e. ae rnhs ut e rae o. Bac nm frpouto rlae:[atr rnh ae o rdcin eess mse] Bac nm fr"etrlae dvlpet [eeo] rnh ae o nx ees" eeomn: dvlp Hwt nm yu spotn bac peie? o o ae or uprig rnh rfxs Fauebace?[etr/ etr rnhs faue] Rlaebace?[ees/ ees rnhs rlae] Hti bace?[ofx] ofx rnhs hti/ Spotbace?[upr/ upr rnhs spot] Vrintgpei?[ eso a rfx ]

Tip: Automatically accept the  default branch names ~$gtfo ii i lw nt d #Acpstedfutbac nms cet h eal rnh ae.

Features $gtfo faue i lw etr l s : lists all features it c e k u : checks out an existing feature hcot s a t starts a new feature tr: f n s : finishes a feature iih p b i h pushes a feature into a remote repo uls: p l : pulls a feature from a remote repo ul

Start a new feature branch ~$gtfo fauesat{ae i lw etr tr nm} ~$gtfo fauesatfo i lw etr tr o Sice t anwbac 'etr/o' wthd o e rnh fauefo Smayo atos umr f cin: -Anwbac 'etr/o'wscetd bsdo 'eeo' e rnh fauefo a rae, ae n dvlp -Yuaenwo bac 'etr/o' o r o n rnh fauefo Nw satcmitn o yu faue We dn,ue o, tr omtig n or etr. hn oe s: gtfo fauefns fo i lw etr iih o

Add and commit changes ~$duhd amnmn rs l di_eu ~$gtadstsalmdlscnrbamnmn i d ie/l/oue/oti/di_eu ~$gtcmi - "de amnmn" i omt m Add di_eu

Recommended: Rebase Your Feature Ensure that your feature is up-to-date ~$gtfo fauerbs i lw etr eae Wl tyt rbs 'o'. il r o eae fo.. Frt rwnigha t rpa yu wr o tpo i.. is, eidn ed o ely or ok n o f t. Apyn:Addamnmn plig de di_eu

Finish a feature ~$gtfo fauefns {ae i lw etr iih nm} ~$gtfo fauefns fo i lw etr iih o Sice t bac 'eeo' wthd o rnh dvlp Udtn 50da.473 paig c45.6814 Fs-owr atfrad .. . 3 flscagd 55 isrin() 1 ie hne, 01 netos+ Dltdbac fauefo(a 6814. eee rnh etr/o ws 473) Smayo atos umr f cin: -Tefauebac 'etr/o'wsmre it 'eeo' h etr rnh fauefo a egd no dvlp -Fauebac 'etr/o'hsbe rmvd etr rnh fauefo a en eoe -Yuaenwo bac 'eeo' o r o n rnh dvlp And repeat...

Releases $gtfo rlae i lw ees l s : lists existing releases it s a t starts a new release tr: f n s : finishes a release iih

Start a new release ~$gtfo rlaesat{eso} i lw ees tr vrin ~$gtfo rlaesat21-30. i lw ees tr 040-20 Sice t anwbac 'ees/040-20 wthd o e rnh rlae21-30.' Smayo atos umr f cin: -Anwbac 'ees/040-20 wscetd bsdo 'eeo' e rnh rlae21-30.' a rae, ae n dvlp -Yuaenwo bac 'ees/040-20 o r o n rnh rlae21-30.' Flo-patos olwu cin: -Bm tevrinnme nw up h eso ubr o! -Satcmitn ls-iuefxsi peaigyu rlae tr omtig atmnt ie n rprn or ees -We dn,rn hn oe u: gtfo rlaefns '040-20 i lw ees iih 21-30.'

Finish a release ~$gtfo rlaefns {eso} i lw ees iih vrin ~$gtfo rlaefns 21-30. i lw ees iih 040-20 .. . Dltdbac rlae21-30. (a faed. eee rnh ees/040-20 ws 2e7) Smayo atos umr f cin: -Lts ojcshv be fthdfo 'rgn aet bet ae en ece rm oii' -Rlaebac hsbe mre it 'atr ees rnh a en egd no mse' -Terlaewstge '040-20 h ees a agd 21-30.' -Rlaebac hsbe bc-egdit 'eeo' ees rnh a en akmre no dvlp -Rlaebac 'ees/040-20 hsbe dltd ees rnh rlae21-30.' a en eee

Pushing changes remotely ~$gtps -al i uh -l #Ps tecagst termt bace. uh h hne o h eoe rnhs ~$gtps -tg i uh -as #Ps tetg. uh h as

Tip: Finish a release in one command ~$gtfo rlaefns -m{esg}{eso} i lw ees iih p msae vrin #Seiyacmi msaeadatmtclyps tecags pcf omt esg n uoaial uh h hne. ~$gtfo rlaefns -m21-30. 21-30. i lw ees iih p 040-20 040-20

finish-sprint.sh ~$.fns-pits 21-30. /iihsrn.h 040-21 #/i/ah !bnbs DUA_I=/aht/rpldcot RPLDR"pt/odua/oro" TG$ A=1 i [- $A ] te f z TG ; hn #Atgms b seiid a ut e pcfe. eh 'o ms seiyatg' co Yu ut pcf a. f i #G it teDua drcoy o no h rpl ietr c $RPLDR d DUA_I #SatanwGtFo rlae tr e i lw ees. gtfo rlaesat$A i lw ees tr TG F #Fuhtecce ls h ah. duhc al rs c l #Epr tedtbs xot h aaae duhsldm -gi -rsl-ie./b$A.q rs q-up -zp -eutfl=.d/TGsl gtad./b$A.q i d .d/TGsl gtcmi - "xotddtbs fr$A" i omt m Epre aaae o TG #Fns adps terlae iih n uh h ees gtfo rlaefns -m$A $A i lw ees iih p TG TG

Hotfixes $gtfo hti i lw ofx l s : list all hotfixes it s a t start a hotfix tr: f n s : finish a hotfix iih

Create a new hotfix ~$gtfo hti sat{eso} i lw ofx tr vrin ~$gtfo hti sat21-30. i lw ofx tr 040-22 Sice t anwbac 'ofx21-30.' wthd o e rnh hti/040-22 Smayo atos umr f cin: -Anwbac 'ofx21-30.'wscetd bsdo 'atr e rnh hti/040-22 a rae, ae n mse' -Yuaenwo bac 'ofx21-30.' o r o n rnh hti/040-22 Flo-patos olwu cin: -Bm tevrinnme nw up h eso ubr o! -Satcmitn yu htfxs tr omtig or o ie -We dn,rn hn oe u: gtfo hti fns '040-22 i lw ofx iih 21-30.'

Commit your fixes ~$gtc -m'pae .tces i i a Udtd hacs' [ofx21-30. 6078 Udtd.tces hti/040-22 d43] pae hacs 1fl cagd 4isrin() 4dltosie hne, netos+, eein()

Finish the hotfix ~$gtfo hti fns 21-30. i lw ofx iih 040-22 Sice t bac 'atr wthd o rnh mse' Mremd b te'eusv'srtg. eg ae y h rcrie taey .tces|8++-hacs ++-1fl cagd 4isrin() 4dltosie hne, netos+, eein() Sice t bac 'eeo' wthd o rnh dvlp Mremd b te'eusv'srtg. eg ae y h rcrie taey .tces|8++-hacs ++-1fl cagd 4isrin() 4dltosie hne, netos+, eein() Dltdbac hti/040-22(a 6078. eee rnh ofx21-30. ws d43) Smayo atos umr f cin: -Lts ojcshv be fthdfo 'rgn aet bet ae en ece rm oii' -Hti bac hsbe mre it 'atr ofx rnh a en egd no mse' -Tehti wstge '040-22 h ofx a agd 21-30.' -Hti bac hsbe bc-egdit 'eeo' ofx rnh a en akmre no dvlp -Hti bac 'ofx21-30.'hsbe dltd ofx rnh hti/040-22 a en eee

Resources http://nvie.com/posts/a-successful-git-branching-model/ http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/ http://danielkummer.github.io/git-flow-cheatsheet/ https://github.com/nvie/gitflow https://github.com/nvie/gitflow/wiki

Demo

Questions?

Thanks Feedback appreciated! Slides: http://www.oliverdavies.co.uk/git-flow Session evaluation: http://2014.drupalcamplondon.co.uk/node/add/session-evaluation? nid=86

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

Never Commit to Master: An Introduction to Git Flow ...

Never Commit to Master: An Introduction to Git Flow by Oliver Davies. Published March 2, 2014 in Technology. Oliver Davies. 9 Presentations. Star this Talk ...
Read more

Essential Git - An introduction to Git on Windows

Essential Git is a beginner’s ... Introduction. This Git introductory guide assumes ... I still use Git, I just commit everything to the master ...
Read more

Gitflow Workflow | Atlassian Git Tutorial

The Gitflow Workflow streamlines the ... to integrate it with her local commits: git pull --rebase origin master ... never interact directly with master.
Read more

A successful Git branching model » nvie.com

A successful Git branching ... , but I’ve never really found the time to do so ... that commit on master must be tagged for easy future reference to this ...
Read more

GitHub - nvie/gitflow: Git extensions to provide high ...

For the best introduction to get started with git flow, ... /gitflow.git cd gitflow git branch master ... the arg must be a commit on master.
Read more

Git/Introduction - Wikibooks, open books for an open world

Git/Introduction. From Wikibooks, open ... $ git commit -m 'My first commit' [master ... this means your paragraphs flow far off the edge of the screen, ...
Read more

Gitlab flow · Workflow · Help - US Department of Energy

After that you commit them to ... a set of practices we call GitLab flow. Git flow ... merged into the master branch. Git flow is a well defined ...
Read more

Read Git Flow | Leanpub

The pattern illustrated here uses git without the git flow ... Features should never interact directly with master. ... commit git checkout master git ...
Read more

Daniel Kummer's Git Flow cheatsheet - GitHub Pages

Basic tips. Git flow provides excellent command line help and output. Read it carefully to see what's happening... The OSX/Windows Client Sourcetree is an ...
Read more