git y drupal

15
Git y Drupal Drupalcamp Spain 2012, Madrid Juan Pablo Novillo Requena (juampy)

Upload: juan-pablo-novillo-requena

Post on 08-May-2015

782 views

Category:

Technology


1 download

DESCRIPTION

Charla sobre Git y Drupal en la Drupalcamp Spain 2012. http://2012.drupalcamp.es/es/sesiones/git-y-drupal-91 https://vimeo.com/55596907

TRANSCRIPT

Page 1: Git y drupal

Git y DrupalDrupalcamp Spain 2012, Madrid

Juan Pablo Novillo Requena (juampy)

Page 2: Git y drupal

Acerca de mí

● Drupal developer en

● Módulos Twitter, OAuth y Devel(juampy en Drupal.org)

● Autor de Drush User's Guide#drushguide

Page 3: Git y drupal

Introducción

Page 4: Git y drupal

Gestión de ramas

1. Modelo simple con una rama master y ramas temporales para sprints/casos.

master

1.0 1.3 2.0

sprint-1 ticket-#230

proyecto-a

1.1 1.2 1.4 1.5 1.6

Page 5: Git y drupal

Gestión de ramas (2)

Git flow

● 2 ramas fijas.

● Feature, release,y hot-fixes.

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

Page 6: Git y drupal

Diferencias entre ramas (log y diff)

log y diff se pueden utilizar de la misma forma:git log|diff [desde][..hasta] [-- path]

Ejemplos:

● git log master..2.5

● git diff master..dev

● git log dev..HEAD -- sites/all/modules/custom

Page 7: Git y drupal

Localizar un bug (git bisect)HEAD

1. git bisect start HEAD HEAD~10

2. git bisect bad3. git bisect good

Page 8: Git y drupal

Ver el autor de una línea (git blame)

● Muestra el último commit que modificó cada línea de un archivo

$ git blame sites/all/modules/contrib/views/views.module28161496 (Daniel Wehner 2011-05-28 14:25:16 +0200 20) * Implements hook_forms().

$ git show 28161496 #769322 by bojanz: Allow views to be...

http://drupal.org/node/769322

Page 9: Git y drupal

Modificar commits antes del push

git rebase -i HEAD~3

Permite:● Editar un commit.

● Eliminar commits.

● Juntar varios commits en uno.

● Ejecutar un comando entre commits.

Page 10: Git y drupal

Si haces git rebase -i de commits pusheados...

http://stuffpoint.com/happy-tree-friends/image/99668-happy-tree-friends-booom.jpg

Page 11: Git y drupal

Crear un parche (método sencillo)

$ cd sites/all/modules/contrib$ git clone --recursive --branch 7.x-3.x http://git.drupal.org/project/views.git

$ cd views

[haz tus cambios]

$ git diff > [description]-[issue-number]- [comment-number].patch

Page 12: Git y drupal

Crear un parche (método avanzado)$ git clone --recursive --branch 7.x-3.x http://git.drupal.org/project/views.git

$ cd views

[haz tus cambios]

$ git commit -A -m "Issue #XXXXX by Y,Z: Título"$ git format-patch origin/7.x-3.x --stdout > [project_name]-[short-description]-[issue-number]- [comment-number].patch

Page 13: Git y drupal

Ejemplos

Con git format-patchhttp://drupal.org/files/pathauto_entity-bulk-update-support-1407176-1.patch

Con git diffhttp://drupal.org/files/views_slideshow_1499552-03.patch

Page 14: Git y drupal

Aplicar un parche

$ wget [URL del parche]

[revisar los paths dentro del parche]

$ git apply -v [parche]

[verificar los cambios]

$ git commit -A -m "Aplicado parche de http://..."

Page 15: Git y drupal

Preguntas

● @juampy72

● linkedin.com/in/juampy

● http://drupal.org/user/682736 (juampy)