Apresentando Drupal e Git na Latinoware 2011

Acabo de apresentar na DrupalCamp, e estou postando para me lembrar do que eu devo fazer próxima vez que vier apresentar este assunto:

  • Branches sao uma forma excelente de manter patches em modulos contribuidos (ou no core), basta rodar git rebase origin/NOVAVERSAO
  • Mostrar o exemplo acima na prática é ótimo. Ter um repo com um módulo pronto pra patchear.
  • Como contribuir com git format-patch. Mostrar as práticas da comunidade, com imagens do drupal.org
  • Estudar melhor como evitar (ou como causar) desastres com git. Ou melhor, apresentar direto o rebase workflow.
  • Drupal DoG desperta interesse. Melhor mostrar git submodule add
  • É melhor marcar o tempo, nunca é rápido como parece.
  • Trazer o próprio PC. Nunca vir de novo sem PC. Aliás, nunca aceitar que os PCs todos queimaram: eles sao essenciais SEMPRE.

Anexo eu deixo o gist dos meus slides, para ver a versao bonita deles é preciso rodar o slideshow e ver o html. Resumidamente, enquanto eu nao crio uma documentacao do slideshow:

gem install slideshow slideshow drupal-and-git.textile

h1. Drupal & git: Best Friends Forever

h2. git init

* descentralizado: cada um quebra o seu
* rápido: se você está usando linux :)
* simples: se você ñ trouxer vicios...

h1. Drupal & git: primeiros passos

h2. git setup

* git config --global user.name "Drupal Hacker"
* git config --global user.email "quelque@chose.fr"

# http://help.github.com/set-your-user-name-email-and-github-token/

h1. Drupal & git: forever alone workflow

h2. primeira vez:

* git init
* git add .
* git commit -m "es mi primer commit, ¿lo hice bien?"

h2. dia a dia:

* git status
* git add meu-arquivo.css
* git commit

h1. Drupal & git: fork me please

h2. repositorios na rede

* github
* gitorious
* codeplane
* midominio.com

h2. copiando pra lá

* git remote add origin git@github.com:hacker/the-best-theme-ever.git
* git push -u origin master
* blog, tweet, etc

h1. Drupal & git: fork me please

h2. pensando no futuro

* git checkout -b footer
* edita, comita, edita, comita, edita, comita

h2. quem sobe é o master

* git checkout master
* git merge footer
* git push

h1. Drupal & git: vida social (yes we fork)

h2. adiciona o fork amigo

* git remote add bestfriend git://amizade.com/amigao/the-best-theme-ever.git
* git fetch bestfriend
* git merge bestfriend

CONFLICT: merge in meu-arquivo.css
Automatic merge failed, fix conflicts and commit the result.

h1. Drupal & git: vida social (yes we fork)

h2. (ñ) briga com o amigo

* edita

{% code %}
<<<<<<< HEAD:meu-arquivo.css  
body.node {  
=======  
body.page-node {  
>>>>>>> 78a33d3:meu-arquivo.css
{% end %}

* git add meu-arquivo.css
* git commit

h1. Drupal & git: vida social (yes we fork)

h2. evitando desastres:

* sempre use branches
* nunca rode git push --force
* git config --system receive.denyNonFastForwards true
* use mais de um repo na rede, use um workflow de rebase

h1. Drupal & git: rebase workflow ftw

* git remote add oficial git://servidor-oficial/projeto.git
* git fetch oficial
* git checkout oficial/master
* git checkout -b bugfix-complicado
* edita, comita, edita, comita, edita, comita
* git fetch oficial
* git rebase oficial/master
* git push minha-versao-no-github bugfix-complicado
* merge request (pode ser por telefone, email, tambor, bat sinal)

# http://randyfay.com/node/89
# http://randyfay.com/node/91

h1. Drupal & git: livin la vida Drupal

* git clone drupal://zen

{% code  %}
[url "http://git.drupal.org/project/"]
  insteadOf = drupal://
{% end  %}

* git checkout -b issue-version
* edita, comita
* git fetch origin
* git rebase origin/7.x-3.x

Commit message

{% code %}
#5775848 by barraponto: this bug was boring my life to death
{% end %}

h1. Drupal & git: livin la vida Drupal

* git format-patch origin/7.x-3-x --stdout > ~/Patches/#5775848-way-boring-bug-5.patch
* posta no drupal.org, espera o mantenedor commitar (cutuque ele no twitter)

# https://github.com/barraponto/dotfiles/blob/master/gitconfig My git config
# http://drupal.org/node/707484 Making a Drupal patch with git
# http://drupal.org/node/1054616 Advanced Patch contributor Guide

h1. Drupal & git: livin la vida Drupal

h2. Dog (o futuro?)

* http://drupal.org/project/dog
* http://groups.drupal.org/node/140949

h2. como faz?

* git clone drupal://drupal
* git checkout origin/7.x
* git submodule add -b 7.x-3.x drupal://zen
* git submodule add -b 7.x-2.x github://pathauto

* dog manifests (tipo os make files)

h1. Drupal & git: referencias

* http://help.github.com/set-your-user-name-email-and-github-token/
* http://valeriofarias.com/git-para-designers/
* http://randyfay.com/node/89
* http://randyfay.com/node/91
* http://drupal.org/node/707484
* http://drupal.org/node/1054616
* https://github.com/barraponto/dotfiles/blob/master/gitconfig
* http://drupal.org/project/dog
* http://groups.drupal.org/node/140949