Skip to content

Instantly share code, notes, and snippets.

@davidszotten
Created November 1, 2012 10:26
Show Gist options
  • Select an option

  • Save davidszotten/3992951 to your computer and use it in GitHub Desktop.

Select an option

Save davidszotten/3992951 to your computer and use it in GitHub Desktop.
Verify that a list of pull requests have been merged into a given branch
#!/bin/bash
progname=$(basename $0)
if [ "$1" = "--setup" ]
then
origin=$(git config --get remote.origin.url)
git remote add pulls $origin
git config remote.pulls.fetch "+refs/pull/*/head:refs/remotes/pulls/pr/*"
elif [ -z "$(git config --get remote.pulls.url)" ]
then
echo "To install, run $progname --setup. This adds a remote called \
'pulls' pointing to github pull requests."
exit
fi
if [ -z $1 ]
then
echo "Usage: $progname base #pr #pr2"
fi
# relies on a second remote called pulls
# git remote add pulls [email protected]:user/repo.git
# git config remote.pulls.fetch "+refs/pull/*/head:refs/remotes/pulls/pr/*"
base=$1
pulls=${@:2}
for pull in $pulls
do
if [ -n "$(git log $base..pulls/pr/$pull)" ]
then
echo $pull
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment