package
Boost your productivity & automate tasks when working with GitHub, all from the comfort of your CLI.
npm install ghGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
zenorocha
zno.rocha@gmail.com
Boost your productivity & automate tasks when working with GitHub, all from the comfort of your CLI.
--info - Get information about a pull request--list - List pull requests--fetch - Rebase or Merge pull request into new branch--comment - Comment on a pull request--fwd - Forward a pull request to another reviewer--open | --close - Open or Close a pull request--submit - Open or Close a pull request--browser - Open GitHub pull request page in the browser
--new - Create new issues--comment - Comment on an issue of a repository--list - List issues on a repository--open | --close - Open or Close an issue--browser - Open GitHub issue page in the browser--lock - Lock GitHub issue--search - Search issues in current repository--assign - Assign an issue on a repository to a user
--browser - Open the GitHub repository page in the browser--list - List repos--create - Create a new GitHub repository and clone on the current directory--fork - Fork a GitHub repository--delete - Delete a repository of specified user--clone - Clone a repository--label --new - Create or delete a label for a repository--label --delete - Delete a label for a repository--label --list - List labels for a repositorynpm install -g ghSimple example: list prs for current repo
gh prHuge thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
For detailed instructions, check Contributing. Don't miss the source code reports.
For detailed changelog, check Releases.
We support the node versions that the Node.js organization supports which as of now is Node v6 & up.
Under the hood, we are using @octokit/rest to work with the GitHub API
The method of authentication that we use with octokit, is a personal access token
You have two options here: 1. Run gh which will start the authentication process & generate the token for you automatically - Though they are hidden, the downside of this is having to type your user & pass - Supports 2fa 2. Manually generate your personal token & add it to your ~/.gh.json
gh helpList all comands options.
gh help --allList specific command options.
gh help <command>| Option | Usage | Type |
|---|---|---|
--verbose | Optional | Boolean |
--insane | Optional | Boolean |
--no-color | Optional | Boolean |
--no-hooks | Optional | Boolean |
The verbose flag is useful for debugging issues. The insane flag is a more complete verbose flag, which leaks more privacy sensitive data by default.
gh pull-requestAlias:
gh pr
| Option | Usage | Type |
|---|---|---|
-u, --user | Required | String |
-I, --info | Required | Boolean |
-n, --number | Required | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Get information about a pull request.
gh pr --info 1| Option | Usage | Type |
|---|---|---|
-l, --list | Required | Boolean |
-a, --all | Optional | Boolean |
-O, --org | Optional | String |
-m, --me | Optional | Boolean |
-d, --detailed | Optional | Boolean |
--direction | Optional | [asc, desc] |
--date | Optional | String |
-b, --branch | Optional | String |
--remote | Optional | String |
-r, --repo | Optional | String |
--sort | Optional | [created, updated, popularity, long-running, complexity] |
-S, --state | Optional | [open, closed] |
-u, --user | Optional | String |
--link | Optional | Boolean |
user is owner of the repository, it is the authenticated user by default.remote is the name of the remote configuration in a git directory, i.e. origin, upstream."pretty_print": false to your ~/.gh-json configShortcut for listing open pull requests for the current repository
gh prList open pull requests for all branches from all your repositories.
gh pr --list --allList open pull requests for all branches in all repositories belonging to the "github" organization.
gh pr --list --all --org githubList open pull requests sent by logged user on current repository.
gh pr --list --meList open pull requests in node-gh/gh repository.
gh pr --list --user node-gh --repo ghList open pull requests with link and content.
gh pr --list --detailedList open pull requests for a branch.
gh pr --list --branch masterList open pull requests and sort them by popularity (comment count).
gh pr --list --sort popularityList open pull requests and sort them by asc long-running (old but still active).
gh pr --list --sort long-running --direction ascList open pull requests and sort them by complexity (complexity is calculated based on number of additions, deletions, changed files, comments and review comments).
gh pr --list --sort complexityList open pull requests with their link
gh pr --list --linkList open pull requests with a formatted date (Any string that the moment library's formatter accepts should work: https://momentjs.com/docs/#/displaying/format/).
gh pr --list --date "dddd, MMMM Do YYYY, h:mm:ss a"| Option | Usage | Type |
|---|---|---|
-f, --fetch | Required | Boolean |
-M, --merge | Required | Boolean |
-R, --rebase | Required | Boolean |
-n, --number | Optional | Number |
-b, --branch | Optional | String |
--draft | Optional | Boolean |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Omitting --number will try to guess the pull number from branch name e.g. pr-1 results in --number 1. Omitting --branch will merge or rebase into config.default_branch.
Shortcut for fetching pull request and checkout into a new branch pr-1.
gh pr 1Merge or rebase pull request into a local branch.
gh pr 1 --fetch --mergegh pr 1 --fetch --rebaseMerge or rebase pull request into branch dev.
gh pr 1 --fetch --rebase --branch devgh pr 1 --fetch --merge --branch dev| Option | Usage | Type |
|---|---|---|
-c, --comment | Required | String |
-n, --number | Required | Number |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Comment on a pull request.
gh pr 1 --comment "Merged, thank you!"Submit a pull request using your default editor by passing an empty --comment
gh pr 1 --comment| Option | Usage | Type |
|---|---|---|
--fwd | Required | String |
-n, --number | Required | Number |
Omitting a value for --fwd fallbacks to the default_pr_forwarder key found
in your config file.
Forward a pull request to another reviewer.
gh pr 1 --fwd username| Option | Usage | Type |
|---|---|---|
-o, --open | Required | Boolean |
-C, --close | Required | Boolean |
-n, --number | Required | Number |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Open a pull request.
gh pr 1 --openClose a pull request.
gh pr 1 --closeClose multiple pull requests.
gh pr --close --number 1 --number 2Open multiple pull requests.
gh pr --open --number 1 --number 2Open or close a pull request that you've sent to someone.
gh pr 1 --close --user eduardolundgren| Option | Usage | Type |
|---|---|---|
-s, --submit | Required | String |
-b, --branch | Optional | String |
-D, --description | Optional | String |
-i, --issue | Optional | Number |
-r, --repo | Optional | String |
-t, --title | Optional | String |
Omitting a value for --submit fallbacks to the default_pr_reviewer key found
in your config file. Omitting --title will submit a pull request
using the last commit message as title.
Submit a pull request using the current branch to the repository owner or organization.
gh pr --submit eduardolundgren --title 'Fix #32' --description 'Awesome fix'Submit a pull request using your default editor by passing an empty --title and or --description
gh pr --submit eduardolundgren --title --descriptionSubmit a pull request using the current branch to dev branch.
gh pr --submit eduardolundgren --branch devSubmit a pull request from a issue.
gh pr --submit eduardolundgren --issue 150Submit a pull request in draft state.
gh pr --submit eduardolundgren --draft| Option | Usage | Type |
|---|---|---|
-B, --browser | Required | Boolean |
-n, --number | Required | Number |
-u, --user | Optional | String |
-r, --repo | Optional | String |
Open GitHub pull request page in the browser.
gh pr 100 --browsergh notificationAlias:
gh nt
| Option | Usage | Type |
|---|---|---|
-l, --latest | Required | Boolean |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
--date | Optional | String |
Shortcut for displaying the latest activities on the current repository.
gh ntDisplay the latest activities on a certain repository.
gh nt --latest --user eduardolundgren --repo node-ghDiplay notifications with a formatted date (Any string that the moment library's formatter accepts should work: https://momentjs.com/docs/#/displaying/format/).
gh nt --date "dddd, MMMM Do YYYY, h:mm:ss a"| Option | Usage | Type |
|---|---|---|
-w, --watch | Required | Boolean |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Watch for any activity on the current repository.
gh nt --watchWatch for any activity on a certain repository.
gh nt --watch --user eduardolundgren --repo node-ghgh issueAlias:
gh is
| Option | Usage | Type |
|---|---|---|
-N, --new | Required | Boolean |
-t, --title | Required | String |
-A, --assignee | Optional | String |
-L, --labels | Optional | String |
-m, --message | Optional | String |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Shortcut for creating a new issue on the current repository.
gh is 'Node GH rocks!' 'Body with **Markdown** support'Create a new issue using your default editor by passing an empty --message (also works with an empty title)
gh is --new --title 'Node GH rocks!' --messageCreate a new issue on a certain repository.
gh is --new --title 'Node GH rocks!' --message 'Body with **Markdown** support' --user eduardolundgren --repo node-ghCreate a new issue with labels.
gh is --new --title 'Node GH rocks!' --labels bug,question,testCreate a new issue and assign it to someone.
gh is --new --title 'Node GH rocks!' --assignee zenorocha| Option | Usage | Type |
|---|---|---|
-c, --comment | Required | String |
-n, --number | Required | Number |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Comment on an issue of the current repository.
gh is 1 --comment 'Node GH rocks!'Comment on an issue using your default editor by passing an empty --comment (also works with an empty title)
gh is 1 --commentComment on an issue of a certain repository.
gh is 1 --comment 'Node GH rocks!' --user eduardolundgren --repo node-gh| Option | Usage | Type |
|---|---|---|
-o, --open | Required | Boolean |
-C, --close | Required | Boolean |
-n, --number | Required | Number |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Open an issue.
gh is 1 --openClose an issue.
gh is 1 --closeClose multiple issues.
gh is --close --number 1 --number 2Open multiple issues.
gh is --open --number 1 --number 2Open or close an issue that you've sent to someone.
gh is 1 --close --user eduardolundgren| Option | Usage | Type |
|---|---|---|
-l, --list | Required | Boolean |
-a, --all | Optional | Boolean |
-A, --assignee | Optional | String |
--date | Optional | String |
-d, --detailed | Optional | Boolean |
-L, --labels | Optional | String |
-M, --milestone | Optional | [Number, String] |
--remote | Optional | String |
-r, --repo | Optional | String |
-S, --state | Optional | [open, closed] |
-u, --user | Optional | String |
Shortcut for listing all issues on the current repository.
gh isList all issues from all repositories.
gh is --list --allList issues assigned to someone.
gh is --list --assignee zenorochaList issues with link and content.
gh is --list --detailedList only closed issues on the current repository.
gh is --list --state closedList issues with a formatted date (Any string that the moment library's formatter accepts should work: https://momentjs.com/docs/#/displaying/format/).
gh is --list --date "dddd, MMMM Do YYYY, h:mm:ss a"List issues filtered by milestone title.
gh is --list --milestone "milestone title"List issues that contains labels todo and bug.
gh is --list --labels todo,bugList all issues on a certain repository.
gh is --list --user eduardolundgren --repo node-gh| Option | Usage | Type |
|---|---|---|
-B, --browser | Required | Boolean |
-n, --number | Required | Number |
-u, --user | Optional | String |
-r, --repo | Optional | String |
Shortcut for opening GitHub issue page in the browser.
gh is 100Open GitHub issue page in the browser.
gh is 100 --browser| Option | Usage | Type |
|---|---|---|
--lock | Required | Boolean |
--lock-reason | Optional | [off-topic, too heated, resolved, spam] |
-n, --number | Required | Number |
--remote | Optional | String |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Lock issue on the current repository.
gh is 1 --lockLock issue on the current repository with a reason.
gh is 1 --lock --lock-reason resolved| Option | Usage | Type |
|---|---|---|
-s, --search | Required | Boolean |
-a, --all | Optional | Boolean |
-d, --detailed | Optional | Boolean |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Search issues in current repository
gh is --search 'term'Search issues in all repositories for a user
gh is --all --user node-gh --search 'term'Search issues in a repository for a user
gh is --user node-gh --repo gh --search 'term'Search issues in a repository for a user with link and content
gh is --user node-gh --repo gh --search 'term'Search issues with github filters
gh is --user node-gh --repo gh --search 'updated:<=2013-05-24'| Option | Usage | Type |
|---|---|---|
--assign | Required | Boolean |
-A, --assignee | Required | String |
-n, --number | Required | Number |
-r, --repo | Optional | String |
-u, --user | Optional | String |
Assign an issue on the current repository to a user.
gh is --assign --assignee zenorocha --number 1Assign an issue on a specific repository to a user.
gh is --assign --assignee zenorocha --number 1 --user eduardolundgren --repo ghgh repoAlias:
gh re
| Option | Usage | Type |
|---|---|---|
-B, --browser | Required | Boolean |
-u, --user | Optional | String |
-r, --repo | Optional | String |
Shortcut for opening the GitHub repository page in the browser.
gh reOpen GitHub repository page in the browser.
gh re --browser --user eduardolundgren --repo node-gh| Option | Usage | Type |
|---|---|---|
-l, --list | Required | Boolean |
-d, --detailed | Optional | Boolean |
-u, --user | Optional | String |
-t, --type | Optional | [all, owner, public, private, member] |
--date | Optional | String |
List all repositories.
gh re --listList all private repositories.
gh re --list --type privateList all repositories from someone.
gh re --list --user zenorochaList open repositories with a formatted date (Any string that the moment library's formatter accepts should work: https://momentjs.com/docs/#/displaying/format/).
gh re --list --detailed --date "dddd, MMMM Do YYYY, h:mm:ss a"| Option | Usage | Type |
|---|---|---|
-N, --new | Required | String |
-O, --organization | Optional | String |
-c, --clone | Optional | Boolean |
-t, --type | Optional | [private] |
--init | Optional | Boolean |
--gitignore | Optional | String |
--homepage | Optional | String |
--description | Optional | String |
Create a new GitHub repository and clone on the current directory.
gh re --new foo --cloneCreate a new GitHub repository based on the name of the current directory & init with a README
gh re --new --clone --initCreate a new GitHub repository for an organization.
gh re --new foo --organization node-ghCreate a new GitHub repository using .gitignore template for Ruby.
gh re --new gemified --gitignore RubyCreate a new private repository on GitHub, initializing it with a initial commit of the README.
gh re --new foo --init --type private| Option | Usage | Type |
|---|---|---|
-f, --fork | Required | String |
-u, --user | Required | String |
-O, --organization | Optional | String |
Fork a GitHub repository.
gh re --fork repo --user userFork a GitHub repository into the node-gh organization.
gh re --fork repo --user user --organization node-gh| Option | Usage | Type |
|---|---|---|
-D, --delete | Required | String |
-u, --user | Required | String |
Delete a repository of the logged user.
gh re --delete foo| Option | Usage | Type |
|---|---|---|
-c, --clone | Required | String |
-r, --repo | Required | String |
-O, --organization | Optional | String |
-P, --protocol | Optional | String |
-u, --user | Optional | String |
If you have custom ssh config, you can add
"api": { "ssh_host": "custom-name", ... }to your .gh.json file.
Clone a repository.
gh re --clone --repo ghClone a repository from a specific user using HTTPS protocol.
gh re --clone --user eduardolundgren --repo gh --protocol https| Option | Usage | Type |
|---|---|---|
-C, --color | Required | String |
-L, --label | Required | Boolean |
-N, --new | Required | String |
-r, --repo | Required | String |
-O, --organization | Optional | String |
-u, --user | Optional | String |
Create a label for a repository (color is a hex code with or without literal hex symbol).
gh re --label --new bug --color '#7057ff' --repo ghCreate a label for a user's repository.
gh re --label --new bug --color '#7057ff' --user eduardolundgren --repo gh| Option | Usage | Type |
|---|---|---|
-L, --label | Required | Boolean |
-D, --delete | Required | String |
-r, --repo | Required | String |
-O, --organization | Optional | String |
-u, --user | Optional | String |
Delete a label from a repository.
gh re --label --delete bug --repo ghDelete a label from a user's repository.
gh re --label --delete bug --user eduardolundgren --repo gh| Option | Usage | Type |
|---|---|---|
-L, --label | Required | Boolean |
-l, --list | Required | Boolean |
-r, --repo | Required | String |
-O, --organization | Optional | String |
-u, --user | Optional | String |
List labels for a repository.
gh re --label --list --repo ghList labels for a user's repository.
gh re --label --list --user eduardolundgren --repo gh| Option | Usage | Type |
|---|---|---|
-C, --color | Required | String |
-L, --label | Required | Boolean |
-r, --repo | Required | String |
-U, --update | Required | String |
-O, --organization | Optional | String |
-u, --user | Optional | String |
Update a label for a repository (color is a hex code with or without literal hex symbol).
gh re --label --update bug --color color --repo ghUpdate a label for a user's repository.
gh re --label --update bug --color color --user eduardolundgren --repo ghFind repositories via various criteria. Repository search looks through the projects you have access to on GitHub. You can filter the results using GitHub's search qualifiers. Examples:
| Option | Usage | Type |
|---|---|---|
-s, --search | Required | Boolean |
-d, --detailed | Optional | Boolean |
-u, --user | Optional | String |
-r, --repo | Optional | String |
-O, --organization | Optional | String |
-t, --type | Optional | [all, owner, public, private, member] |
Search private repositories you have access to with the term "secret".
gh re --search secret --type privateOR
gh re --search secret is:privateMatches repositories from GitHub org showing detailed results.
gh re --detailed -o github --search octocatOR
gh re --detailed --search octocat org:githubgh gistsAlias:
gh gi
| Option | Usage | Type |
|---|---|---|
-B, --browser | Required | Boolean |
-u, --user | Optional | String |
-i, --id | Optional | String |
Shortcut for opening your Gists in the browser.
gh giOpen a Gist in the browser.
gh gi --browser --id 5991877| Option | Usage | Type |
|---|---|---|
-l, --list | Required | Boolean |
-u, --user | Optional | String |
--date | Optional | String |
List all gists.
gh gi --listList all gists from someone.
gh gi --list --user brunocoelhoList gists with a formatted date (Any string that the moment library's formatter accepts should work: https://momentjs.com/docs/#/displaying/format/).
gh gi --list --date "dddd, MMMM Do YYYY, h:mm:ss a"| Option | Usage | Type |
|---|---|---|
-N, --new | Required | String |
-c, --content | Optional | String |
-d, --description | Optional | String |
-p, --private | Optional | Boolean |
--label --updateGregory Amerson 💻 🐛 |
Tom Rochette 💻 🐛 🚇 |
Mike Roberts 💻 |
Snyk bot 💻 |
Nate Cavanaugh 💻 |
Peter Dave Hello 💻 |
Matt DesLauriers 💻 |
oughter 💻 |
Andrey 💻 |
André de Oliveira 💻 |
Brandon Patram 💻 |
Chema Balsas 💻 |
Henri Cavalcante 💻 |
Jaka Hudoklin 💻 |
José F. Romaniello 💻 |
Joshua Wu 💻 |
Randѕon 💻 |
Alex Hall 💻 |
Rossi Oddet 💻 |
Ryan Schmukler 💻 |
Xavier RENE-CORAIL 💻 |
YAMAMOTO Yuji 💻 |
Sam Mikes 💻 |
Tiju Thomas 💻 |
Ryan Schumacher 🐛 |
Rob Dodson 🐛 |
Derek Sifford 🐛 |
rachidbch 🐛 |
Liraz Siri 🐛 |
Dante Wang 🐛 |
Raymond Augé 🐛 |
Mohamed Bassem 🐛 |
Rich Sezov 🐛 |
Jason Kuhrt 🐛 |
Gabriel Izaias 🐛 |
Myles McNamara 🐛 |
Gilad Peleg 🐛 |
Yoshua Wuyts 🐛 |
Sergio Gonzalez 🐛 |
Djalma Araújo 🐛 |
Bruno Basto 🐛 |
Jason Pincin 🐛 |
Ramon Pires da Silva 🔌 |
Patrick Weingärtner 💻 |
Gabriel Ramos 💻 |
Manuel de la Peña 💻 |
Aaron Berry 💻 |
Inácio Nery 🐛 💻 |
Marcus Bizal 🐛 |
Julien Castelain 🐛 💻 |
Estimated unpacked size across 65 packages.
16.3 MB+
Includes dependencies.
7.0.0
~1.3.3
1.4.0
~4.17.15
4.18.1
~0.7.0
18.2.0
~2.23.0
2.31.0
~11.0.3
14.0.0
~2.88.0
2.88.2
~6.2.1
14.3.0
~2.0.1
3.0.0
~1.0.0
1.0.1
~1.0.0
1.0.0
~2.0.0
3.1.0
~0.5.1
0.6.5
~4.6.0
4.7.10
~16.25.0
22.0.1
0.20.0
0.22.0
~3.2.0
8.0.0
~4.0.0
7.3.1
~4.1.1
7.1.0
11.0.5