Created
May 5, 2013 00:51
-
-
Save jimweirich/5519290 to your computer and use it in GitHub Desktop.
Script I use to pull in pull requests from GitHub
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
#!/usr/bin/ruby -wKU | |
if ARGV.empty? | |
puts "Usage: pullrequest user:branch" | |
exit 1 | |
end | |
url = `git config --get remote.origin.url` | |
unless %r{([^/]+)\.git$} =~ url | |
puts "Unable to determine repo from url (#{url})" | |
exit 1 | |
end | |
repo = $1 | |
user, branch = ARGV.first.split(/:/) | |
system "git pull https://github.com/#{user}/#{repo}.git #{branch}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A pull request from github comes with user name and remote branch in the form user:branch (e.g. randycoulman:default-thread-pool-size). Copy the user:branch into your paste buffer. Then in your local repot do:
At this point, the pull request will be in your local branch. Check it out, run the tests and see if everything is ok. If you like the result, merge my-branch into master and push to github. If you don't like the changes, delete the branch and ask the pull requester to make improvements.