A command line interface for github.
- Python 2.7 or greater
- git
ghub
is a simple command line utility for facilitating common
tasks with github. It uses the repository found in the current
working directory to determine upstream
and origin
URLs. You
can also use a single origin
repo if you prefer.
More exhaustive tools exist (see http://hub.github.com for one example). This tool is intended to be simple, fast and have few dependencies.
This tool is a work in progress.
- Generate a personal access token from github.
- Store the access token in your gitconfig. This has potentially
serious security implications. Only do this on a machine you trust:
git config --global github.token <token value>
- Install ghub:
git clone git@github.com:ccstolley/ghub cd ghub python ./setup.py install
- Create remote repositories for
upstream
andorigin
. Eg.:git remote add origin git@github.com:joesmith/ghub # optional git remote add upstream git@github.com:ccstolley/ghub
- Drink a beer.
usage: ghub [-h] [-i [number]] [-p [number]] [-d number] [-n base_branch]
[-m number] [-c number] [-v]
command line interface to github
optional arguments:
-h, --help show this help message and exit
-i [number], --showissue [number]
show issue #, or show all for specified user
-p [number], --showpull [number]
show pull request # or show all
-d number, --diff number
show diff for pull request #
-n base_branch, --newpull base_branch
create a new pull request from the current branch to
base_branch
-m number, --mergepull number
merge pull request #
-c number, --comment number
post comment on issue #
-v, --verbose be verbose
Display a specific issue:
ghub -i 442
Post a comment to a specific issue:
ghub -c 442
List all open issues assigned to me in this repo:
ghub -i
List all unassigned open issues in this repo:
ghub -i none
List all open issues in this repo:
ghub -i '*'
List issues assigned to ccstolley, including comments and summary:
ghub -i ccstolley -v
Create a pull request from the current branch to the specific upstream branch:
ghub -n dev
Display pull request and comments:
ghub -p 101
Merge pull request:
ghub -m 101
Display pull request diff in color (requires cdiff):
ghub -d 101 | cdiff