-
-
Save dinglixiang/11164075 to your computer and use it in GitHub Desktop.
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/env ruby | |
# Install gems: | |
# gem install github_api | |
# gem install hub | |
# | |
# Then run script in github repo | |
require 'github_api' | |
g = Github.new | |
path = `git remote show -n origin | grep Fetch | cut -d: -f2-` | |
raise "You're not in a git repo with an origin remote" if path.empty? | |
username, repo = path.split("/")[0].split(":")[1], path.split("/")[1].split(".")[0] | |
forks = g.repos.forks.list username, repo | |
usernames = forks.map(&:owner).map(&:login) | |
usernames.each do |username| | |
puts "hub fetch #{username}" | |
`hub fetch #{username}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment