Find the repository from where a given repo was forked

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

MIT licensed by Noon Silk
Maintained by


Takes a repo name, and looks up the upstream repository. If there is an upstream repository, writes it to standard out. Otherwise writes nothing.


noon@dev> infer-upstream -r scirate3 -u silky

Another usage:

noon@dev> cd scirate3 noon@dev> git remote add upstream infer-upstream --using-cwd

A more interesting usage (and the reason I wrote this) is to use the script. It performs the following task.

For all folders in a given directory:

  • go into each one,
  • if it is a github repo,
  • look up the upstream repo,
  • if we find it,
  • set it as a new remote.


noon@~> cd dev noon@dev> git clone noon@dev> infer-upstream/ ...

With upstream set on your repos, you can then run, if you like, which will bring down any incoming changes and give print out a short summary.


noon@dev>infer-upstream/ fetching upstream for Javascript-Voronoi ... 1 file changed, 2 insertions(+), 2 deletions(-)


  • This script assumes every folder in the ~/dev directory is the clone of a

Github repository. Github currently limits you to 60 unauthenticated API requests per hour*; this approach uses one API request per folder.

Used by 1 package:
comments powered byDisqus