Skip to content

Instantly share code, notes, and snippets.

@betacar
Created September 25, 2014 15:13
Show Gist options
  • Save betacar/43fc4a8dfc58f1f5589b to your computer and use it in GitHub Desktop.
Save betacar/43fc4a8dfc58f1f5589b to your computer and use it in GitHub Desktop.
Print all pull requests from a commit to the branch HEAD
# This should be inside your git config file (global or for a project) as an alias,
# in order to print all merged PRs between a given SHA and current git HEAD.
#
# Thanks to Etan Reisner: http://stackoverflow.com/a/25954749/315748
# Usage: $ git release [SHA]
# It will print...
# [COMMIT-SHA] #PR-NUMBER PULL REQUEST TITLE
# ie.
# [2046946] #872 Lorem ipsum dolor sit amet
[alias]
release = !"bash -c 'git log --grep=\"Merge pull\" --pretty=format:\"[%h] %s %b\" $1..HEAD | awk \"{\\$2=\\$3=\\$4=\\$6=\\$7=\\\"\\\";gsub(/ +/,\\\" \\\",\\$0);\\$2=\\$2 \\\":\\\";print}\"' -"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment