Skip to content

Instantly share code, notes, and snippets.

@sillygwailo
Last active December 22, 2015 20:39
Show Gist options
  • Save sillygwailo/6527986 to your computer and use it in GitHub Desktop.
Save sillygwailo/6527986 to your computer and use it in GitHub Desktop.
My Git workflow for Drupal.org issues

Git workflow for Drupal.org issues

Inspired by chx's workflow http://drupal4hu.com/node/374, this is the workflow I used when working on multiple issues at the same time to rename Views functions.

This workflow worked for me. YMMV.

Starting out:

  1. git clone --branch 8.x http://git.drupal.org/project/drupal.git 8 # checkout all of Drupal into a directory called 8
  2. Start working on an issue. Make commits on your work. Since you likely don't have commit access to the Drupal project, you won't break anything for anybody else.
  3. Oops, I forgot to make a branch for this 'feature'. Good thing there's git checkout -b. Using https://drupal.org/node/2002348 as an example:
  • git checkout -b 2002348-rename-advanced_render
  1. Do you have git completion setup? I'm thinking maybe you should have git completion setup.
  2. Make a patch based on the current branch you're on. This creates a patch with the branch name.
  • git diff 8.x > $(git rev-parse --abbrev-ref HEAD).patch
  1. On a Mac, you'll still need to attach the file.
  • open -R $(git rev-parse --abbrev-ref HEAD).patch # will open finder at the location of the patch you created
  • then in the issue, click "Choose File", then drag and drop the patch from Finder into the dialog box.

Later on, when you need to re-roll:

  1. git checkout 8.x
  2. git pull
  3. git checkout 2002348[TAB] # that is, paste in the issue number, then press the TAB button to tab complete, since you probably forgot what the human-friendly part of the branch title
  4. git merge 8.x
  5. Same as step #5 above.
  6. Same as step #6 above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment