g + h = github
Fast GitHub command line client implemented in Go. Current version is 0.8.0.
Overview
gh is a command line client to GitHub. It's designed to run as fast as possible with easy installation across operating systems.
If you like gh, please also take a look at hub. Hub is a reference implementation to gh.
Motivation
Fast
$ time hub version > /dev/null
hub version > /dev/null 0.03s user 0.01s system 93% cpu 0.047 total
$ time gh version > /dev/null
gh version > /dev/null 0.01s user 0.01s system 85% cpu 0.022 total
$ time hub browse > /dev/null
hub browse > /dev/null 0.07s user 0.04s system 87% cpu 0.130 total
$ time gh browse > /dev/null
gh browse > /dev/null 0.03s user 0.02s system 87% cpu 0.059 total
Muti-platforms
gh is fully implemented in the Go language and is designed to run across operating systems.
Easy installation
There're no pre-requirements to run gh. Download the binary and go!
Unix
gh commands are single, unhyphenated words that map to their Unix ancestors’ names and flags where applicable.
Installation
There are compiled binary forms of gh for Darwin, Linux and Windows.
To install gh on OSX with Homebrew, run:
$ brew install https://raw.github.com/jingweno/gh/master/homebrew/gh.rb
Compilation
To compile gh from source, you need to have a Go development environment, version 1.1 or better, and run:
$ go get github.com/jingweno/gh
Note that go get
will pull down sources from various VCS.
Please make sure you have git and hg installed.
Upgrade
Since gh is under heavy development, I roll out new releases often.
Please take a look at the built binaries for the latest built binaries.
I plan to implement automatic upgrade in the future.
To upgrade gh on OSX with Homebrew, run:
$ brew upgrade https://raw.github.com/jingweno/gh/master/homebrew/gh.rb
To upgrade gh from source, run:
$ go get -u github.com/jingweno/gh
Usage
gh help
$ gh help
Usage: gh [command] [options] [arguments]
Remote Commands:
remote View and manage a set of remote repositories
GitHub Commands:
pull Open a pull request on GitHub
fork Make a fork of a remote repository on GitHub and add as remote
ci Show CI status of a commit
browse Open a GitHub page in the default browser
compare Open a compare page on GitHub
version Show gh version
See 'gh help [command]' for more information about a command.
gh checkout
$ gh checkout https://github.com/jingweno/gh/pull/35
> git remote add -f -t feature git://github:com/foo/gh.git
> git checkout --track -B foo-feature foo/feature
$ gh checkout https://github.com/jingweno/gh/pull/35 custom-branch-name
gh remote
$ gh remote add jingweno
> git remote add -f jingweno git://github.com/jingweno/CURRENT_REPO.git
$ gh remote add -p jingweno
> git remote add -f jingweno git@github.com:jingweno/CURRENT_REPO.git
$ gh remote add origin
> git remote add -f YOUR_USER git://github.com/YOUR_USER/CURRENT_REPO.git
gh pr
# while on a topic branch called "feature":
$ gh pr
[ opens text editor to edit title & body for the request ]
[ opened pull request on GitHub for "YOUR_USER:feature" ]
# explicit pull base & head:
$ gh pr -b jingweno:master -h jingweno:feature
$ gh pr -i 123
[ attached pull request to issue #123 ]
gh fork
$ gh fork
[ repo forked on GitHub ]
> git remote add -f YOUR_USER git@github.com:YOUR_USER/CURRENT_REPO.git
$ gh fork --no-remote
[ repo forked on GitHub ]
gh ci
$ gh ci
> (prints CI state of HEAD and exits with appropriate code)
> One of: success (0), error (1), failure (1), pending (2), no
> status (3)
$ gh ci BRANCH
> (prints CI state of BRANCH and exits with appropriate code)
> One of: success (0), error (1), failure (1), pending (2), no
> status (3)
$ gh ci SHA
> (prints CI state of SHA and exits with appropriate code)
> One of: success (0), error (1), failure (1), pending (2), no
> status (3)
gh browse
$ gh browse
> open https://github.com/YOUR_USER/CURRENT_REPO
$ gh browse commit/SHA
> open https://github.com/YOUR_USER/CURRENT_REPO/commit/SHA
$ gh browse issues
> open https://github.com/YOUR_USER/CURRENT_REPO/issues
$ gh browse -u jingweno -r gh
> open https://github.com/jingweno/gh
$ gh browse -u jingweno -r gh commit/SHA
> open https://github.com/jingweno/gh/commit/SHA
$ gh browse -r resque
> open https://github.com/YOUR_USER/resque
$ gh browse -r resque network
> open https://github.com/YOUR_USER/resque/network
gh compare
$ gh compare refactor
> open https://github.com/CURRENT_REPO/compare/refactor
$ gh compare 1.0..1.1
> open https://github.com/CURRENT_REPO/compare/1.0...1.1
$ gh compare -u other-user patch
> open https://github.com/other-user/REPO/compare/patch
Release Notes
See RELEASE_NOTES.md.
Roadmap
- authentication (done)
- gh pull-request (done)
- gh ci-status (done)
- gh browse (done)
- gh compare (done)
- gh fork (done)
- gh remote add (done)
- gh checkout (done)
- gh clone (in progress)
- gh fetch
- gh cherry-pick
- gh am, gh apply
- gh merge
- gh create
- gh init
- gh push
- gh submodule
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
)
- Commit your changes (
git commit -am 'Add some feature'
)
- Push to the branch (
git push origin my-new-feature
)
- Create new Pull Request
Contributors
See CONTRIBUTORS.md.
License
gh is released under the MIT license. See LICENSE.md.