SlideShare une entreprise Scribd logo
1  sur  60
GitFlow
Javier Alvarez
@JManGT
Esta obra está licenciada bajo la Licencia Creative Commons Atribución-CompartirIgual 4.0 Internacional. Para ver una
copia de esta licencia, visita http://creativecommons.org/licenses/by-sa/4.0/.
GIT
Versionamiento de Código
Lo Básico
Environments, Branches, Tags, Merge
Environments
Vagrant + Puppet
Branches
$ git branch
> * master
Branches
$ git branch mi-branch
> * master
mi-branch
Branches
Master
abc001
abc002
….
abc008
commits
branch
Branches
Master
abc001
abc002
….
abc008
Mi-branch
xyz001
xyz002
…
$ git checkout mi-branch
Tags
Master
abc001
abc002
….
abc123
Mi-branch
xyz001
xyz002
…
V0.2.0V0.1.0 xyz025
$ git tag –a v0.2.0
Tags
Master
abc001
abc002
….
abc123
Mi-branch
xyz001
xyz002
…
V0.2.0V0.1.0 xyz025
Tags
Master
abc001
abc002
….
abc123
Mi-branch
xyz001
xyz002
…
V0.2.0V0.1.0 xyz025
opq001
Experimento
$ git branch experimento
Merge
Master
abc001
abc002
….
abc123
Mi-branch
xyz001
xyz002
V0.1.0
xyz025
xyz025 V0.2.0
$ git merge experimiento
Merge
Master
abc001
abc002
….
abc123
Mi-branch
xyz001
xyz002
V0.1.0
xyz025
xyz025 V0.2.0
$ git branch -D mi-branch
Checkout
Master
abc001
abc002
….
abc123 V0.1.0
xyz025 V0.2.0
$ git clone repo
$ git tags –l
> v0.2.0
v0.1.0
$ git checkout tags/v0.2.0
$ git checkout tags/v0.1.0
Workflow
Problemas Comunes
Master a Master
MasterMaster
Mi Máquina El Server
$ git push server master
Master a Master
MasterMaster
El Server
No es posible corregir el bug hasta completar el feature
V0.1.0 abc001
abc002
Nuevo Feature abc001
abc003
abc123 ¡BUG!
Feature
Incompleto
Master / Edge
MasterMaster
Mi Máquina El Server
Dos branches en la máquina de desarrollo
Edge
V0.1.0 abc001
abc123
Master / Edge
MasterMaster
Mi Máquina El Server
Podemos corregir el bug directamente a master
Edge
V0.1.0 abc001
abc123
Master / Edge
MasterMaster
Mi Máquina El Server
Agregamos el bugfix a Edge
Edge
V0.1.0 abc001
abc123
xyz001 xyz001
xyz001
Workflow
Trabajo en Equipo
En Equipo
Master
Cada desarrollador trabaja a partir de Edge
Edge
abc123
abc001V0.1.0
Edge
xyz033
Edge
opq654
Pedro Juan
Release
Master
Todos hacen push a edge
Edge
abc001V0.1.0
Edge Edge
Pedro Juan
V0.2.0
Release
Lo que se prueba no es lo que se libera
MasterEdge
Bug - MarioFeature - JuanMario - Edge
Gitflow
Metodología de Branching
Branches Principales
Master
2 branch permanentes
Edge
Commit Inicial
Version 1.0
Version 2.0
Nuevos Features
Branches Desarrollo
Principales
• Master
• Edge
Desarrollo
• Feature
• Release
• Hotfix
Feature Branch
Independizar el desarrollo de
features
Feature Branch
Master
Branch temporal hasta completar el feature
Edge
Commit Inicial
Version 1.0
Version 2.0
Feature
Feature Completo
Feature Branch
Generamos un nuevo feature branch desde edge
EdgeFeature
Feature Completo
$ git checkout feature edge
Feature Branch
Completamos el feature haciendo merge a edge y borrando el feature
branch
EdgeFeature
Feature Completo
$ git checkout edge
$ git merge –no-ff feature
$ git branch –d feature
$ git push origin develop
Feature Branch
Multiples feature branches se actualizan desde Edge
Edgefeature/Bfeature/A
Release Branch
Congelar y Estabilizar
Release Branch
Congelamos el código del release
Edge Release/0.2.0
Feature/A
Master
Bump a 0.2.0
V0.1.0
$ git checkout –b release/0.2.0 edge
< bump de la version de mi codigo >
$ git commit –am “Bump 0.2.0”
Release Branch
Estabilizamos el código del release
Edge Release
Feature/A
Master
V0.1.0
Código estable
Release Branch
Edge puede segir avanzando independientemente
Edge Release
Feature/A
Master
v0.2.0
V0.1.0
Feature/B
Feature/C Código estable
Finalizar Release
Dos pasos para finalizar el Release Branch
Edge Release/0.2.0Master
V0.1.0
v0.2.0
Finalizar Release
Merge de feature a master. Generar release tag.
Edge Release/0.2.0Master
V0.1.0
$ git checkout master
$ git merge –no-ff release/0.2.0
$ git tag –a v0.2.0
V0.2.0
Finalizar Release
Merge de feature a master. Generar release tag.
Edge Release/0.2.0Master
V0.1.0
$ git checkout develop
$ git merge –no-ff release/0.2.0
$ git tag –a v0.2.0
V0.2.0
Finalizar Release
Eliminamos el release branch
Edge Release/0.2.0Master
V0.1.0
$ git branch –d release/0.2.0
V0.2.0
Finalizar Release
Master está estable y Edge tiene nuevos features.
Release/0.2.0Master
V0.1.0
V0.2.0
Edge
Feature/A
Feature/A
Feature/A
Feature/B
Feature/C
A, B y C
Hotfix Branch
Correción de Errores FATALES
Hotfix Branch
Hotfix branch nace desde Master
Hotfix MasterEdge
v0.2.0
v0.2.1
Hotfix Branch
Generamos un hotfix branch y hacemos bump de la version
Hotfix MasterEdge
v0.2.0
$ git branch –d hotfix/0.2.1 master
<Bump de version a 0.2.1>
$ git commit –am “Bump a 0.2.1”
Hotfix Branch
Corregimos el bug
Hotfix MasterEdge
v0.2.0
$ git commit –am “Fix bug #123”
Finalizar Hotfix
Finalizamos Hotfix branch haciendo merge a master.
Hotfix MasterEdge
v0.2.0
$ git checkout master
$ git merge –-no-ff hotfix/0.2.1
$ git tag –a 0.2.1
v0.2.1
Finalizar Hotfix
Incluimos el parche tambien en edge.
Hotfix MasterEdge
v0.2.0
$ git checkout edge
$ git merge –-no-ff hotfix/0.2.1
v0.2.1
Finalizar Hotfix
Eliminamos el Hotfix Branch
Hotfix MasterEdge
v0.2.0
$ git branch –d hotfix/0.2.1
v0.2.1
Gitflow
Git plugin
https://github.com/nvie/gitflow
Gitflow Git plugin
Ubuntu
# apt-get install git-flow
Fedora
# yum install gitflow
Mac
$ brew install git-flow
Inicializar Repositorio
➜ mi-app git:(master) ✗ git flow init
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master]
Branch name for "next release" development: [develop] edge
How to name your supporting branch prefixes?
Feature branches? [feature/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
➜ mi-app git:(edge) ✗
Feature Branch
➜ mi-app git:(edge) ✗ git flow feature start homepage
Switched to a new branch 'feature/homepage'
Summary of actions:
- A new branch 'feature/homepage' was created, based on 'edge'
- You are now on branch 'feature/homepage'
Now, start committing on your feature. When done, use:
git flow feature finish homepage
➜ mi-app git:(feature/homepage) ✗
Finalizar Feature Branch
➜ mi-app git:(feature/homepage) git flow feature finish homepage
Switched to branch 'edge'
Updating 4d2c7d8..0812b3b
Fast-forward
hello.txt | 0
homepage.html | 0
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello.txt
create mode 100644 homepage.html
Deleted branch feature/homepage (was 0812b3b).
Summary of actions:
- The feature branch 'feature/homepage' was merged into 'edge'
- Feature branch 'feature/homepage' has been removed
- You are now on branch 'edge'
➜ mi-app git:(edge)
Release Branch
➜ mi-app git:(edge) git flow release start v0.1.0
Switched to a new branch 'release/v0.1.0'
Summary of actions:
- A new branch 'release/v0.1.0' was created, based on 'edge'
- You are now on branch 'release/v0.1.0'
Follow-up actions:
- Bump the version number now!
- Start committing last-minute fixes in preparing your release
- When done, run:
git flow release finish 'v0.1.0’
➜ mi-app git:(release/v0.1.2)
Release Branch
➜ mi-app git:(release/v0.1.0) git flow release finish v0.1.0
Switched to branch 'master'
Merge made by the 'recursive' strategy.
hello.txt | 0
homepage.html | 0
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hello.txt
create mode 100644 homepage.html
Deleted branch release/v0.1.0 (was 0812b3b).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Release branch has been merged into 'master'
- The release was tagged 'v0.1.0'
- Release branch has been back-merged into 'edge'
- Release branch 'release/v0.1.0' has been deleted
➜ mi-app git:(master)
Hotfix Branch
➜ mi-app git:(master) git flow hotfix start v0.1.1
Switched to a new branch 'hotfix/v0.1.1'
Summary of actions:
- A new branch 'hotfix/v0.1.1' was created, based on 'master'
- You are now on branch 'hotfix/v0.1.1'
Follow-up actions:
- Bump the version number now!
- Start committing your hot fixes
- When done, run:
git flow hotfix finish 'v0.1.1'
➜ mi-app git:(hotfix/v0.1.1)
Hotfix Branch
➜ mi-app git:(hotfix/v0.1.1) ✗ git commit -am "Fix bug #123"
[hotfix/v0.1.1 f7f9caa] Fix bug #123
1 file changed, 1 insertion(+)
➜ mi-app git:(hotfix/v0.1.1) git flow hotfix finish v0.1.1
Switched to branch 'master'
Merge made by the 'recursive' strategy.
homepage.html | 1 +
1 file changed, 1 insertion(+)
Switched to branch 'edge'
Merge made by the 'recursive' strategy.
homepage.html | 1 +
1 file changed, 1 insertion(+)
Deleted branch hotfix/v0.1.1 (was f7f9caa).
Summary of actions:
- Latest objects have been fetched from 'origin'
- Hotfix branch has been merged into 'master'
- The hotfix was tagged 'v0.1.1'
- Hotfix branch has been back-merged into 'edge'
- Hotfix branch 'hotfix/v0.1.1' has been deleted
➜ mi-app git:(edge)
A successful Git
branching model
http://nvie.com/posts/a-successful-git-branching-model/
Gracias
por su
sintonía
@JmanGt
Javier Alvarez

Contenu connexe

Tendances

Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowMikhail Melnik
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflowsArthur Shvetsov
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierChristoph Matthies
 
Git with the flow
Git with the flowGit with the flow
Git with the flowDana White
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentationMack Hardy
 
Git & SourceTree
Git & SourceTreeGit & SourceTree
Git & SourceTreeTu Tran
 
Git Flow - An Introduction
Git Flow - An IntroductionGit Flow - An Introduction
Git Flow - An IntroductionKnoldus Inc.
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model abodeltae
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsMikhail Melnik
 
DcATL 2013: Git-Flow for Daily Use
DcATL 2013: Git-Flow for Daily UseDcATL 2013: Git-Flow for Daily Use
DcATL 2013: Git-Flow for Daily UseMediacurrent
 
The gitflow way
The gitflow wayThe gitflow way
The gitflow wayRuijun Li
 
Git Flow and JavaScript Coding Style
Git Flow and JavaScript Coding StyleGit Flow and JavaScript Coding Style
Git Flow and JavaScript Coding StyleBo-Yi Wu
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabShinu Suresh
 

Tendances (20)

Git flow
Git flowGit flow
Git flow
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
git flow
git flowgit flow
git flow
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
My Git workflow
My Git workflowMy Git workflow
My Git workflow
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Git with the flow
Git with the flowGit with the flow
Git with the flow
 
Git
GitGit
Git
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Git & SourceTree
Git & SourceTreeGit & SourceTree
Git & SourceTree
 
Git Flow - An Introduction
Git Flow - An IntroductionGit Flow - An Introduction
Git Flow - An Introduction
 
Git workflows
Git workflowsGit workflows
Git workflows
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and Tags
 
DcATL 2013: Git-Flow for Daily Use
DcATL 2013: Git-Flow for Daily UseDcATL 2013: Git-Flow for Daily Use
DcATL 2013: Git-Flow for Daily Use
 
The gitflow way
The gitflow wayThe gitflow way
The gitflow way
 
Git advanced
Git advancedGit advanced
Git advanced
 
Git Flow and JavaScript Coding Style
Git Flow and JavaScript Coding StyleGit Flow and JavaScript Coding Style
Git Flow and JavaScript Coding Style
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 

En vedette

Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Bosstmacwilliam
 
Community live #1 - Gitflow Workflow
Community live #1 - Gitflow WorkflowCommunity live #1 - Gitflow Workflow
Community live #1 - Gitflow WorkflowLiora Milbaum
 
Git like a Pro (How to use it as it was meant to)
Git like a Pro (How to use it as it was meant to)Git like a Pro (How to use it as it was meant to)
Git like a Pro (How to use it as it was meant to)Dennis Doomen
 
Puppet at GitHub - PuppetConf 2013
Puppet at GitHub - PuppetConf 2013Puppet at GitHub - PuppetConf 2013
Puppet at GitHub - PuppetConf 2013Puppet
 
SemVer, the whole story
SemVer, the whole storySemVer, the whole story
SemVer, the whole storyJakeGinnivan
 
Semantic Versioning Lightning Talk
Semantic Versioning Lightning TalkSemantic Versioning Lightning Talk
Semantic Versioning Lightning TalkAaron Blythe
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requestsBartosz Kosarzycki
 

En vedette (7)

Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
Community live #1 - Gitflow Workflow
Community live #1 - Gitflow WorkflowCommunity live #1 - Gitflow Workflow
Community live #1 - Gitflow Workflow
 
Git like a Pro (How to use it as it was meant to)
Git like a Pro (How to use it as it was meant to)Git like a Pro (How to use it as it was meant to)
Git like a Pro (How to use it as it was meant to)
 
Puppet at GitHub - PuppetConf 2013
Puppet at GitHub - PuppetConf 2013Puppet at GitHub - PuppetConf 2013
Puppet at GitHub - PuppetConf 2013
 
SemVer, the whole story
SemVer, the whole storySemVer, the whole story
SemVer, the whole story
 
Semantic Versioning Lightning Talk
Semantic Versioning Lightning TalkSemantic Versioning Lightning Talk
Semantic Versioning Lightning Talk
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
 

Similaire à Gitflow - Una metología para manejo de Branches

Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Codemotion
 
Git development workflow
Git development workflowGit development workflow
Git development workflowSankar Suda
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyVivek Parihar
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitMaulik Shah
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitMaulik Shah
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced gitGerrit Wanderer
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git TogetherRakesh Jha
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-itAutomat-IT
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for developmentGerrit Wanderer
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductortimyates
 

Similaire à Gitflow - Una metología para manejo de Branches (20)

Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git basics
Git basicsGit basics
Git basics
 
Git
GitGit
Git
 
Git development workflow
Git development workflowGit development workflow
Git development workflow
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching Strategy
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
 
Gitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for GitGitflow - Branching and Merging Flow for Git
Gitflow - Branching and Merging Flow for Git
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
 
Lets Git Together
Lets Git TogetherLets Git Together
Lets Git Together
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Git
GitGit
Git
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
 
Gitflow
GitflowGitflow
Gitflow
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
 

Plus de Javier Alvarez

Dal 2013 Guatemla Presentacion Producto
Dal 2013 Guatemla Presentacion ProductoDal 2013 Guatemla Presentacion Producto
Dal 2013 Guatemla Presentacion ProductoJavier Alvarez
 
El poder de un punto y coma
El poder de un punto y comaEl poder de un punto y coma
El poder de un punto y comaJavier Alvarez
 
El rol del profesional de la informatica en el medio
El rol del profesional de la informatica en el medioEl rol del profesional de la informatica en el medio
El rol del profesional de la informatica en el medioJavier Alvarez
 
Introduccion a Crystal Clear - BarcampGt2010
Introduccion a Crystal Clear - BarcampGt2010Introduccion a Crystal Clear - BarcampGt2010
Introduccion a Crystal Clear - BarcampGt2010Javier Alvarez
 

Plus de Javier Alvarez (8)

Dal 2013 Guatemla Presentacion Producto
Dal 2013 Guatemla Presentacion ProductoDal 2013 Guatemla Presentacion Producto
Dal 2013 Guatemla Presentacion Producto
 
El poder de un punto y coma
El poder de un punto y comaEl poder de un punto y coma
El poder de un punto y coma
 
El rol del profesional de la informatica en el medio
El rol del profesional de la informatica en el medioEl rol del profesional de la informatica en el medio
El rol del profesional de la informatica en el medio
 
Bluekite git
Bluekite gitBluekite git
Bluekite git
 
OpenData
OpenDataOpenData
OpenData
 
Agil en guatemala
Agil en guatemalaAgil en guatemala
Agil en guatemala
 
Openwolf
OpenwolfOpenwolf
Openwolf
 
Introduccion a Crystal Clear - BarcampGt2010
Introduccion a Crystal Clear - BarcampGt2010Introduccion a Crystal Clear - BarcampGt2010
Introduccion a Crystal Clear - BarcampGt2010
 

Gitflow - Una metología para manejo de Branches