Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012
-
Upload
rogerio-prado-de-jesus -
Category
Technology
-
view
573 -
download
2
description
Transcript of Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012
![Page 1: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/1.jpg)
BE HAPPY WITH SEMANTIC VERSIONING
AND GIT FLOW
Rogério Prado de Jesus PHP Conference Brasil
Dezembro 2012
![Page 2: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/2.jpg)
QUEM SOU EU?
• @rogeriopradoj - Rogério Prado de Jesus
• PHP desde 2009
• blog: rogeriopradoj.com
• Grupo de usuários: PHPSP
![Page 3: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/3.jpg)
VERSIONAMENTO
É sobre isso que vamos falar…
![Page 4: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/4.jpg)
VERSIONAMENTO
Código Fonte
Mas esse não é o único tipo
![Page 5: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/5.jpg)
VERSIONAMENTO
Código Fonte !
Produto
Temos que lembrar desse aqui também
![Page 6: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/6.jpg)
VERSIONAMENTO
Código Fonte !
VCS git, svn, mercurial, cvs...
!
!
Produto !
iOS 6 Ubuntu 12.10
PHP 5.4.9 jQuery 1.8.3
![Page 7: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/7.jpg)
VERSIONAMENTO: PRODUTO
Publicação
Quando outras pessoas começam a
usar seu produto (site, biblioteca…)
… você precisa de estratégias para
gerenciar isso tudo
![Page 8: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/8.jpg)
SEMANTIC VERSIONING
• http://semver.org/
• https://github.com/rogeriopradoj/translations/blob/master/translated/semantic-versioning/pt_BR.md
… aí que entra o …
enquanto a tradução oficial não for
mesclada
Elaborado pelo criador do
@mojombo
![Page 9: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/9.jpg)
@alganet @augustohphttps://github.com/Respect
descobri sobre o tema com esses dois caras…
… assistindo uma discussão de como gerenciar as versões do projeto deles
![Page 10: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/10.jpg)
SEMANTIC VERSIONING
X.Y.Z
Parece conhecido?
esse é o formato das versões…
![Page 11: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/11.jpg)
SEMANTIC VERSIONING
X.Y.Z
major minor patch
é o que a gente já fazia…
…mas agora com uma regra mais rígida…
…um manifesto!
http://semver.org/
![Page 12: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/12.jpg)
Um dos principais pontos do tema é evitar que você (e seus usuários) entre em pânico quando seu produto cresce
de tamanho…
https://en.wikipedia.org/wiki/Dependency_hell
… e consequentemente o número de dependências
aumenta também
![Page 13: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/13.jpg)
COMPOSER
PACKAGIST
Esses dois caras do PHP sugerem que você use o SEMVER…
…o que facilita a vida de quem for usar os seus pacotes
Slideshares recomendados se quiser saber mais: - http://www.slideshare.net/rdohms - http://www.slideshare.net/rogeriopradoj
http://getcomposer.org/
https://packagist.org/
![Page 14: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/14.jpg)
SEMANTIC VERSIONING
X.Y.Z
major minor patch
Para ninguém esquecer!
http://semver.org/
![Page 15: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/15.jpg)
VERSIONAMENTO
Código Fonte !
Produto !
Já vimos produto…
… vamos para código fonte
![Page 16: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/16.jpg)
VERSIONAMENTO: CÓDIGO FONTE
O que é para você?
![Page 17: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/17.jpg)
index.php
index.php.old
index.php.old.bkp
index.php.old.bkp.2
index.php.old.bkp.2012
… mas tem jeito melhor…
Pode ser isso aqui…
![Page 18: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/18.jpg)
VCS
• Version Control System
• Sistema de controle de versões
• Código fonte
… aqui entra o…
![Page 19: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/19.jpg)
TIPOS VCSCENTRALIZADO
!
DESCENTRALIZADO !
Basicamente são dois tipos…
![Page 20: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/20.jpg)
TIPOS VCSCENTRALIZADO
!
DESCENTRALIZADO !
… sendo essas as ferramentas mais conhecidas de cada um deles
https://subversion.apache.org/ http://www.git-scm.com/
![Page 21: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/21.jpg)
TIPOS VCSCENTRALIZADO
!
DESCENTRALIZADO !
Existe um movimento de migração de projetos (principalmente open
source) para descentralizados…
… o próprio PHP é um dos casos…
https://github.com/php/php-src
![Page 22: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/22.jpg)
RAMIFICANDO O VCS
Complexo e formal Simples e eficiente
cada um deles tem suas
particularidades
![Page 23: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/23.jpg)
esse é o padrão formal no SVN (subversion)…
…que geralmente só usuários avançados
usavam pela complexidade…
… nos manuais de SVN são sempre os últimos
capítulos.
Mesmo assim, corporativamente era um
bom modelo…
… por causa de seu controle e rigidez
(mesmo deixando os DEVs malucos!!!)
Quem nunca ouviu: “para
tudo aí que eu
vou mesclar! e "tô" dando lock!
![Page 24: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/24.jpg)
No GIT a criação de branches é assunto
básico…
… primeiros capítulos do manual
O próprio ícone do GIT mostra uma ramificação!!!
O problema é que não existe formalismo… … o que
corporativamente poderia ser problema
(apesar dos DEVs
adorarem!!!)
![Page 25: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/25.jpg)
A SUCCESSFUL GIT BRANCHING MODEL
• http://nvie.com/posts/a-successful-git-branching-model/
• https://github.com/rogeriopradoj/translations/blob/master/translated/a-successful-git-branching-model/pt_BR.md
Um modelo de ramificação parecido
com o SVN (formal)……mas no GIT (sem os
problemas do SVN)
![Page 26: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/26.jpg)
• Descentralizado Centralizado
É o que eles chamaram de
Descentralizado porque é GIT Centralizado pois
usa um repositório “central”, ou
principal, que é usado para sincronia de todos os outros
![Page 27: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/27.jpg)
Um “origin único” para todos
Mas que não impede que existam as
interações normais do GIT (vários remotos, por
exemplo)
![Page 28: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/28.jpg)
• Descentralizado Centralizado
• Formalização das ramificações / branches
Segundo ponto importante
![Page 29: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/29.jpg)
Main
- feature - release - hotfix
- master - develop
Supporting
Regras para nomes de branches…
… facilitando a comunicação
![Page 30: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/30.jpg)
Time
release branches masterdevelop hotfixesfeature
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/archives/323 License: Creative Commons
Modelo da
empresa NVIE
aplicado…
… que até esse
momento não tinha
nome.
![Page 31: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/31.jpg)
GIT-FLOW
• https://github.com/nvie/gitflow/
• Ferramenta CLI para agilizar o processo de implementação do modelo git flow da NVIE.com
Em pouco tempo foi criado
o nome do modelo…
… e também uma ferramenta para facilitar seu uso fora da NVIE
![Page 32: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/32.jpg)
• http://danielkummer.github.com/git-flow-cheatsheet/
• http://danielkummer.github.com/git-flow-cheatsheet/index.pt_BR.html
Alguns cheatsheets para
facilitar o uso
![Page 33: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/33.jpg)
Importante saber que existem outros fluxos de trabalho no GIT…
…alguns famosos:
GitHub Flow: usado pela empresa GitHub
Git "OpenSource" Flow
Nome inventado por @rogeriopradoj :-)
Principal diferença em relação ao NVIE git-flow: usa menos
branches, mas mantém a ideia de repositório central
É o que é usado na maioria dos projetos OpenSource, com a
ideia de Forks, Pull Requests etc.
![Page 34: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/34.jpg)
SEMANTIC VERSIONING
GIT (*) FLOW
É isso aí, pessoal!
![Page 35: Be Happy With Semantic Versioning And Git Flow - PHP Conference Brasil 2012](https://reader033.fdocuments.in/reader033/viewer/2022052600/5579a5bed8b42ac1148b4aa7/html5/thumbnails/35.jpg)
OBRIGADO!
• about.me/rogeriopradoj