Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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