Skip to content

Instantly share code, notes, and snippets.

@mpdonadio
Created May 5, 2017 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpdonadio/110bed0a5ce77e6bbed8d52c81a2a4cc to your computer and use it in GitHub Desktop.
Save mpdonadio/110bed0a5ce77e6bbed8d52c81a2a4cc to your computer and use it in GitHub Desktop.
Generate a Drupal patch+interdiff when using branch-per-patch method, where branch is issue#-comment#. Doesn't take into account fetching or rebasing.
#!/bin/bash
ISSUE=`git rev-parse --abbrev-ref HEAD | cut -d'-' -f1`
COMMENT1=`git branch | grep -B 1 '*' | head -1 | cut -d'-' -f2`
COMMENT2=`git rev-parse --abbrev-ref HEAD | cut -d'-' -f2`
rm -f *.patch interdiff*.txt
git diff origin/8.4.x > `git rev-parse --abbrev-ref HEAD`.patch
if [ "${COMMENT1}" != "${COMMENT2}" ]; then
git diff ${ISSUE}-${COMMENT1} > interdiff-${COMMENT1}-${COMMENT2}.txt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment