Created
November 1, 2012 10:26
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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