Skip to content

Instantly share code, notes, and snippets.

@patrickkettner
Created August 7, 2014 00:33
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 patrickkettner/ee2f9472709dd6a4843d to your computer and use it in GitHub Desktop.
Save patrickkettner/ee2f9472709dd6a4843d to your computer and use it in GitHub Desktop.
get a list github PR numbers for all pull request branches that have been merged (not rebased)
MERGED_AND_NOT_DELETED=$(
ALL_MERGED_BRANCHES=$(git branch -a --merged master | grep -v '* master' | grep -v 'HEAD ->');
for i in $ALL_MERGED_BRANCHES; do
COMMIT_TO_CHECK=$(git show-ref --hash "$i");
PR_NUMBER=$(git when-merged $COMMIT_TO_CHECK awk '{print $2}')
git --no-pager log --format=%B -n 1 $PR_NUMBER | grep 'Merge pull request';
done
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment