Top Banner
git-flow
56

git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Aug 30, 2019

> version.txt $ git add version.txt" href="https://cupdf.com/download/git-flow-git-flow-release-help-git-flow-release-list-git-flow-release-start" class="btn-download btn-primary">Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git-flow

Page 2: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 4: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 5: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Refresco conceptos Git● Git-flow

● Introdución● Fluxos de traballo● Instalación● Comandos de git-flow

● Exercicio

Contido

Page 6: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git

Page 7: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Distribuído

Page 8: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Equipo 1

V 1

V 2

V 3

Equipo 2

V 1

V 2

V 3

Equipo 3

V 1

V 2

V 3

Servidor

V 1

V 2

V 3

Page 9: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Commit

Page 10: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

SHA-1

Commit 160 bitsFunciónSHA-1

Page 11: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

HEAD75528b9

Commit 1

75528b9

Commit 1

8daf16a

Commit 2

75528b9

Commit 1

8daf16a

Commit 2

a346348

Commit 3

Page 12: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Zonas en GitDirectoriode trabajo

Zona de preparación Repositorio

Preparar archivos

Commit

Checkout

Page 13: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Estados e fluxo

Ignorado

Con seguimientoSin

seguimientoSin

modificación Modificado

Añadir archivo

Edición

Commit

Preparado

Eliminar archivo

Page 14: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Ramas

75528b9

Commit 1

8daf16a

Commit 2

de396a3

Commit 5

a3ae45c

Commit 3

456af81

Commit 4

pruebas

master

HEAD

Page 15: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Repositorios remotos

Page 16: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git remotegit pushgit fetchgit pull

Repositorios remotos

Page 17: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git-flow

Page 18: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 19: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● master ● develop

● Permanentes

Ramas principais

Page 20: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 21: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Feature● Release● Hotfix

● Bugfix● Support

Ramas de soporte

Page 22: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Propósito determinado● Conxunto de regras de uso● Tempo de vida limitado● Ramas normais

Ramas de soporte

Page 23: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 24: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Créanse a partir de develop● Fusiónanse en develop● Nome: calquera, excepto:

● master ● develop ● release-* ● hotfix-*

● Obxectivo: novas funcionalidades

Ramas feature (topic)

Page 25: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 26: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git checkout -b nova_funcionalidade develop

git checkout develop

git merge --no-ff nova_funcionalidade

git branch -d nova_funcionalidade

git push origin develop

Ramas feature (topic)

Page 27: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 28: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Créanse a partir de develop● Fusiónanse en master e en develop● Nome: release-* ● Obxectivo: preparación dunha nova publicación

(release)

Ramas release

Page 29: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 30: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git checkout -b release-2.6 develop

git checkout master

git merge --no-ff release-2.6

git tag -a 2.6

git checkout develop

git merge --no-ff release-2.6

git branch -d release-2.6

Ramas release

Page 31: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Créanse a partir de master● Fusiónanse en master e en develop● Nome: hotfix-* ● Obxectivo: resolución de errores en produción

Ramas hotfix

Page 32: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt
Page 33: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git checkout -b hotfix-2.6.1 master

git checkout master

git merge --no-ff hotfix-2.6.1

git tag -a 2.6.1

git checkout develop

git merge --no-ff hotfix-2.6.1

git branch -d hotfix-2.6.1

Ramas hotfix

Page 34: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Créanse a partir de develop● Fusiónanse en develop● Nome: bugfix-* ● Obxectivo: resolución de errores en

desenvolvemento

Ramas bugfix

Page 35: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git checkout -b bugfix-login develop

git checkout develop

git merge --no-ff bugfix-login

git branch -d bugfix-login

Ramas bugfix

Page 36: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

● Créanse a partir de master● Non se integran noutra rama nin se eliminan● Nome: support-* ● Obxectivo: soporte a sistemas en produción con

versións anticuadas

Ramas support

Page 37: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

git checkout -b support-v2.0-udc 2.0.0

Ramas support

Page 38: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

sudo apt-get install git-flow

sudo dnf install gitflow

brew install git-flow-avh

Instalador de Windows

Linux. Versións antigas: PPA● sudo add-apt-repository ppa:pdoes/gitflow-avh● sudo apt-get update● sudo apt-get install git-flow

Instalación

Page 39: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Comprobación da versión instalada:● git flow version

Instalación

Page 40: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git flow

● init ● feature

● bugfix

● release

● hotfix

● support

● version

● config

● log

Subcomandos

Page 41: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git flow init help

$ git flow init● Nome das ramas● Prefixo das etiquetas

$ cat .git/config

$ git branch

$ git log

git flow init

Page 42: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git clone https://github.com/jquery/jquery.git

$ cd jquery

$ git branch -a -v

$ git flow init

$ git branch -a -v

$ cat .git/config

git flow init

Page 43: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git flow feature help

$ git flow feature list

$ git flow feature start licenciaAdd

$ git branch

$ touch licencia.txt

$ echo 'The MIT License (MIT)' >> licencia.txt

$ echo 'Copyright (c) 2016 Jesús Amieiro Becerra' >> licencia.txt

$ git add licencia.txt

git flow feature

Page 44: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git commit -m "Engado o arquivo de licencia"

$ git remote add origin https://[email protected]/amieiro/git_flow.git

$ git push -u origin master

$ git push -u origin develop

$ git flow feature publish licenciaAdd

git flow feature (II)

Page 45: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

# Usuario 2

$ git clone https://[email protected]/amieiro/git_flow.git

$ git branch -a -v

$ git flow init

$ git flow feature track licenciaAdd

$ git branch -a -v

git flow feature (III)

Page 46: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

# Usuario 1

$ git flow feature finish licenciaAdd

$ git branch -a -v

$ git push

$ git branch -a -v

git flow feature (IV)

Page 47: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

# Usuario 2

$ git checkout master; git pull origin master; git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -n 1 git branch -D

git flow feature (V)

Page 48: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git flow release help

$ git flow release list

$ git flow release start 0.1.0

$ git branch -a -v

$ echo "0.1.0" >> version.txt

$ git add version.txt

$ git commit -m "Engado o arquivo de versión ao proxecto"

$ git flow release publish 0.1.0

git flow release

Page 49: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ echo "Puedes consultar la licencia en la URL https://opensource.org/licenses/MIT" >> licencia.txt

$ git commit -am "Engado la URL de consulta no arquivo de licencia"

$ git flow release publish 0.1.0

$ git flow release finish -F -p 0.1.0

git flow release (II)

Page 50: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git flow hotfix help

$ git flow hotfix list

$ git flow hotfix start 0.1.1

$ echo "0.1.1" > version.txt

$ echo "vendor/" >> .gitignore

$ git add .

$ git commit -m "Añado el archivo .gitignore"

$ git flow hotfix publish 0.1.1

git flow hotfix

Page 51: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

$ git branch -a -v

$ git flow hotfix finish --help

$ git flow hotfix finish -F -p 0.1.1

$ git branch -a -v

$ git log --oneline --all --decorate --graph

git flow hotfix (II)

Page 52: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Onde continuar?Libro “git-flow”

http://nvie.com/posts/a-successful-git-branching-model/

https://github.com/petervanderdoes/gitflow-avh/wiki

https://yakiloo.com/getting-started-git-flow/

Page 53: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Exercicio

Page 54: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

Por parellas: usuario1 (U1) e usuario2 (U2).

Crear 2 contas (1 por usuario) en Bitbucket ou sitio similar.

U1: Crear un proxecto con git-flow.

U1: Crear o arquivo de licenza MIT.

U2: Clonar o proxecto e inicializalo con git-flow.

U2: Crear o arquivo “.gitignore”, excluíndo do seguimento os arquivos “png.”

Exercicio (I)

Page 55: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

U1: Crear a release 0.1.0, cun arquivo “version.txt” onde se indique a versión e publicala.

U2: Crear un arquivo “index.html” con contido válido.

U2: Crear un arquivo “style.css” con contido válido.

U1: resolver un erro coa licencia en produción, que tiña que ser GPL v2 en vez de MIT.

U2. Crear a release 0.2.0, cos novos cambios, e publicalos.

Exercicio (II)

Page 56: git-flow - jesusamieiro.com · $ git flow release help $ git flow release list $ git flow release start 0.1.0 $ git branch -a -v $ echo "0.1.0" >> version.txt $ git add version.txt

www.jesusamieiro.com