Takes a repo name, and looks up the upstream repository. If there is an upstream repository, writes it to standard out. Otherwise writes nothing.
This package is available on hackage so can be installed with
cabal install infer-upstream
Alternatively, you can clone this repo and install with cabal
git clone https://github.com/silky/infer-upstream.git cd infer-upstream cabal install
noon@dev> infer-upstream -r scirate3 -u silky email@example.com:draftable/scirate3.git
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
upstream_everything.sh 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 firstname.lastname@example.org:silky/infer-upstream noon@dev> infer-upstream/upstream_everything.sh ...
upstream set on your repos, you can then run
you like, which will bring down any incoming changes and give print out a
- 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.