Skip to content

Instantly share code, notes, and snippets.

@vijaycs85
Last active August 19, 2018 23:51
Show Gist options
  • Save vijaycs85/ee2a5670c5bc63096be7 to your computer and use it in GitHub Desktop.
Save vijaycs85/ee2a5670c5bc63096be7 to your computer and use it in GitHub Desktop.
# in ~/.bashrc or ~/.bash_profile in OSX
# Jump to comment section of d.o issue, if local git branch = issue nid
alias issue='open /Applications/Google\ Chrome.app https://www.drupal.org/node/$(git symbolic-ref -q HEAD 2>/dev/null | sed '\''s/^refs\/heads\/\([0-9]*\).*/\1/'\'')#project-issue-ajax-form'
# Include/Exclude patch directory to PHPStorm to compare two patches.
alias patchl='ln -s /www/htdocs/patches/ /www/htdocs/drupal8/patches'
alias patchul='rm /www/htdocs/drupal8/patches'
# In ~/.gitconfig file
[alias]
# genpatch 45 === git diff origin/8.5.x > [issue_id]-45.patch. Make sure git branch = issue nid.
genpatch = "!sh -c \"br=`git symbolic-ref HEAD|sed s#refs/heads/##`; git diff origin/8.5.x > /www/htdocs/patches/\\${br}-$1.patch\""
# gendiff 1 42 45 === git diff HEAD~1 HEAD > [issue_id]-diff-42-45.txt. Make sure git branch = issue nid.
gendiff = "!sh -c \"br=`git symbolic-ref HEAD|sed s#refs/heads/##`; git diff HEAD~$1 HEAD > /www/htdocs/patches/\\${br}-diff-$2-$3.txt\""
# Get next comment id:
curl 'https://www.drupal.org/api-d7/comment.json?node\[id\]=2905213' | grep -o 'comment_body' | wc -l | awk '{ SUM += $1 + 2} END { print SUM }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment