Skip to content

Instantly share code, notes, and snippets.

@barraponto
Created October 19, 2011 16:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barraponto/1298875 to your computer and use it in GitHub Desktop.
Save barraponto/1298875 to your computer and use it in GitHub Desktop.
Drupal & Git: Latinoware 2011

Drupal & git: Best Friends Forever

git init

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

Drupal & git: primeiros passos

git setup

  • git config —global user.name “Drupal Hacker”
  • git config —global user.email “quelque@chose.fr”
  1. http://help.github.com/set-your-user-name-email-and-github-token/

Drupal & git: forever alone workflow

primeira vez:

  • git init
  • git add .
  • git commit -m “es mi primer commit, ¿lo hice bien?”

dia a dia:

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

Drupal & git: fork me please

repositorios na rede

  • github
  • gitorious
  • codeplane
  • midominio.com

copiando pra lá

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

Drupal & git: fork me please

pensando no futuro

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

quem sobe é o master

  • git checkout master
  • git merge footer
  • git push

Drupal & git: vida social (yes we fork)

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.

Drupal & git: vida social (yes we fork)

(ñ) 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

Drupal & git: vida social (yes we fork)

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

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)
  1. http://randyfay.com/node/89
  2. http://randyfay.com/node/91

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 %}

  1. by barraponto: this bug was boring my life to death
    {% end %}

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)
  1. https://github.com/barraponto/dotfiles/blob/master/gitconfig My git config
  2. http://drupal.org/node/707484 Making a Drupal patch with git
  3. http://drupal.org/node/1054616 Advanced Patch contributor Guide

Drupal & git: livin la vida Drupal

Dog (o futuro?)

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)

Drupal & git: referencias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment