Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gh

Package Overview
Dependencies
Maintainers
2
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh

GitHub command line tools.

  • 1.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25K
increased by26.79%
Maintainers
2
Weekly downloads
 
Created
Source

Node GH Build Status NPM version

Class Octocat

All the power of GitHub in your terminal.

Table of contents

Usage

gh [command] [payload] [--flags]

Install

[sudo] npm install -g gh

Dependencies

In order to sucessfully run this project you must have NodeJS installed.

Demonstration

Demo

Available commands

gh help

Pull requests

gh pull-request

Alias: gh pr

1. List

OptionUsageType
-l, --listRequiredBoolean
-a, --allOptionalBoolean
-d, --detailedOptionalBoolean
-b, --branchOptionalString
--remoteOptionalString
-r, --repoOptionalString
-S, --stateOptional[open, closed]
-u, --userOptionalString
Examples
  • Shortcut for listing open pulls requests for the current branch.

gh pr ```

  • List open pulls requests for all branches.

gh pr --list --all ```

  • List open pulls requests with link and content.

gh pr --list --detailed ```

  • List open pulls requests for a branch.

gh pr --list --branch master ```

2. Fetch

OptionUsageType
-f, --fetchRequiredBoolean
-n, --numberRequiredNumber
-M, --mergeOptionalBoolean
-R, --rebaseOptionalBoolean
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Shortcut for fetching pull request and checkout into a new branch pull-1.

gh pr 1 ```

  • Fech pull request rebasing or merging into the current branch.

gh pr 1 --fetch --rebase gh pr 1 --fetch --merge ```

3. Merge or rebase

OptionUsageType
-M, --mergeRequiredBoolean
-R, --rebaseRequiredBoolean
-n, --numberOptionalNumber
-b, --branchOptionalString
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString

Omitting --number will try to guess the pull number from branch name e.g. pull-1 results in --number 1. Omitting --branch will merge or rebase into config.default_branch.

Examples
  • Merge or rebase pull request into a branch.

gh pr 1 --fetch --merge ```

```

gh pr 1 --fetch --rebase ```

  • Merge or rebase pull request into branch dev.

gh pr 1 --fetch --rebase --branch dev ```

```

gh pr 1 --fetch --merge --branch dev ```

4. Comment

OptionUsageType
-c, --commentRequiredString
-n, --numberRequiredNumber
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Comment on a pull request.

gh pr 1 --comment "Merged, thank you!" ```

5. Forward

OptionUsageType
--fwdRequiredString
-n, --numberRequiredNumber
Examples
  • Forward a pull request to another reviewer.

gh pr 1 --fwd username ```

6. Open or close

OptionUsageType
-o, --openRequiredBoolean
-C, --closeRequiredBoolean
-n, --numberRequiredNumber
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Open a pull request.

gh pr 1 --open ```

  • Close a pull request.

gh pr 1 --close ```

  • Open or close a pull request that you've sent to someone.

gh pr 1 --close --user eduardolundgren ```

7. Submit

OptionUsageType
-s, --submitRequiredString
-b, --branchOptionalString
-D, --descriptionOptionalString
-r, --repoOptionalString
-t, --titleOptionalString

Omitting --title will submit a pull request using the last commit message as title.

Examples
  • Submit a pull request using the current branch.

gh pr --submit eduardolundgren --title 'Fix #32' --description 'Awesome fix' ```

  • Submit a pull request using the current branch to dev branch.

gh pr --submit eduardolundgren --branch dev ```

Notifications

gh notifications

Alias: gh nt

1. Latest

OptionUsageType
-l, --latestRequiredBoolean
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Shortcut for displaying the latest activities on the current repository.

gh nt ```

  • Display the latest activities on a certain repository.

gh nt --latest --user eduardolundgren --repo node-gh ```

2. Watch

OptionUsageType
-w, --watchRequiredBoolean
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Watch for any activity on the current repository.

gh nt --watch ```

  • Watch for any activity on a certain repository.

gh nt --watch --user eduardolundgren --repo node-gh ```

Issues

gh issue

Alias: gh is

1. Create

OptionUsageType
-N, --newRequiredBoolean
-t, --titleRequiredString
-A, --assigneeOptionalString
-L, --labelOptionalString
-m, --messageOptionalString
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Shortcut for creating a new issue on the current repository.

gh is 'Node GH rocks!' 'Body with Markdown support' ```

  • Create a new issue on a certain repository.

gh is --new --title 'Node GH rocks!' --message 'Body with Markdown support' --user eduardolundgren --repo node-gh ```

  • Create a new issue with labels.

gh is --new --title 'Node GH rocks!' --label bug,question,test ```

  • Create a new issue and assign it to someone.

gh is --new --title 'Node GH rocks!' --assignee zenorocha ```

2. Comment

OptionUsageType
-c, --commentRequiredString
-n, --numberRequiredNumber
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Comment on an issue of the current repository.

gh is 1 --comment 'Node GH rocks!' ```

  • Comment on an issue of a certain repository.

gh is 1 --comment 'Node GH rocks!' --user eduardolundgren --repo node-gh ```

3. Open or close

OptionUsageType
-o, --openRequiredBoolean
-C, --closeRequiredBoolean
-n, --numberRequiredNumber
--remoteOptionalString
-r, --repoOptionalString
-u, --userOptionalString
Examples
  • Open an issue.

gh is 1 --open ```

  • Close an issue.

gh pr 1 --close ```

  • Open or close an issue that you've sent to someone.

gh pr 1 --close --user eduardolundgren ```

4. List

OptionUsageType
-l, --listRequiredBoolean
-a, --allOptionalBoolean
-A, --assigneeOptionalString
-d, --detailedOptionalBoolean
-L, --labelOptionalString
-M, --milestoneOptionalNumber
--remoteOptionalString
-r, --repoOptionalString
-S, --stateOptional[open, closed]
-u, --userOptionalString
Examples
  • Shortcut for listing all issues on the current repository.

gh is ```

  • List all issues from all repositories.

gh is --list --all ```

  • List issues assigned to someone.

gh is --list --assignee zenorocha ```

  • List issues with link and content.

gh is --list --detailed ```

  • List only closed issues on the current repository.

gh is --list --state closed ```

  • List issues filtered by milestone.

gh is --list --milestone 1 ```

  • List issues that contains labels todo and bug.

gh is --list --label todo,bug ```

  • List all issues on a certain repository.

gh is --list --user eduardolundgren --repo node-gh ```

Repo

gh repo

Alias: gh re

1. Open

OptionUsageType
-o, --openRequiredBoolean
-u, --userOptionalString
-r, --repoOptionalString
Examples
  • Shortcut for opening the GitHub repository page.

gh re ```

  • Open GitHub repository page.

gh re --open --user eduardolundgren --repo node-gh ```

2. List

OptionUsageType
-l, --listRequiredBoolean
-d, --detailedOptionalBoolean
-u, --userOptionalString
-t, --typeOptional[all, owner, public, private, member]
Examples
  • List all repositories.

gh re --list ```

  • List all private repositories.

gh re --list --type private ```

  • List all repositories for someone.

gh re --list --user zenorocha ```

3. Create

OptionUsageType
-n, --newRequiredString
-c, --cloneOptionalBoolean
-t, --typeOptional[private]
--initOptionalBoolean
--gitignoreOptionalString
--homepageOptionalString
--descriptionOptionalString
Examples
  • Create a new GitHub repository and clone on the current directory.

gh re --new foo --clone ```

  • Create a new GitHub repository using .gitignore template for Ruby.

gh re --new gemified --gitignore Ruby ```

  • Create a new private repository on GitHub, initializing it with a initial commit of the README.

gh re --new foo --init --type private ```

4. Delete

OptionUsageType
--deleteRequiredString
--userRequiredString
Example
  • Delete a repository named vanilla of the logged user

gh re --delete vanilla ```

User

gh user

Alias: gh us

1. Login/Logout

OptionUsageType
-l, --loginRequiredBoolean
-L, --logoutRequiredBoolean
Examples
  • Login or show current logged in GitHub user.

gh user --login ```

  • Logout current GitHub account.

gh user --logout ```

Alias

gh alias

Alias: gh al

1. List

OptionUsageType
-l, --listRequiredBoolean
Examples
  • Shortcut for listing aliases.

gh alias ```

  • List aliases.

gh alias --list ```

2. Add

OptionUsageType
-a, --addRequiredString
-u, --userRequiredString
Examples
  • Create alias for username.

gh alias --add zeno --user zenorocha ```

3. Remove

OptionUsageType
-r, --removeRequiredString
Examples
  • Remove alias.

gh alias --remove zeno ```

Team

Node GH is maintained by these guys and some awesome contributors.

Eduardo LundgrenZeno Rocha
Eduardo LundgrenZeno Rocha

Contributing

Contribute new commands to this project by copying and editing the content of Hello World example.

History

  • v1.3.1 September 9, 2013
    • Fix log on gh repo --new
    • Add ability to delete a repository
  • v1.3.0 September 8, 2013
    • Add new gh repo command
    • Authenticate with GitHub regardless the command is run from a git repo
    • Use last commit message as pull request title instead of branch name
    • Document gh alias --list
    • Add --assignee flag for issues
    • Fix list issues that are related to a milestone
  • v1.2.2 August 14, 2013
    • Include --description attribute on PR submit
  • v1.2.1 August 12, 2013
    • Parse remote url with score on username
    • Add tests using Mocha
  • v1.2.0 June 7, 2013
    • Add ability to create alias for users
    • Add ability to list all issues/pull requests from a certain user
    • Use git remote values instead of logged user and current repo
    • Add ability to login with a different GitHub user with gh user
  • v1.1.1 June 6, 2013
    • Bug fixes
  • v1.1.0 June 5, 2013
    • Add --milestone filter flag on listing issues
  • v1.0.0 June 4, 2013
    • Rename commands and add shortcut for them
    • Add default action for commands when no flags is passed
  • v0.1.13 June 3, 2013
    • Fixed error using wrong branch name when submitting a pull request
  • v0.1.12 June 3, 2013
    • Enable fetch PRs from private repos
  • v0.1.11 June 2, 2013
    • Add --label, --state and --detailed flags on listing issues
    • Add ability to open/close an Issue
    • Fixed error when running command outside of a Git repo
    • Improve log for listing open and closed pull requests trough --state flag
  • v0.1.10 May 30, 2013
    • Cross platform process.env.HOME
  • v0.1.8 May 30, 2013
    • Open issue in browser
    • Open pull request url on the browser after sending it
  • v0.1.7 May 30, 2013
    • Add ability to set number without --number flag
  • v0.1.6 May 30, 2013
    • Add ability to specify a title on gh pr --submit
    • Add password mask on authentication
    • Bug fixes
  • v0.1.5 May 29, 2013
    • Fix pull request integrity check
  • v0.1.4 May 28, 2013
    • Add ability to create an Issue
    • Add ability to comment on an Issue
    • Rename pull request --comment to --message
    • Rename pull request --pull to --number
  • v0.1.3 May 28, 2013
    • Remove mustache dependency
  • v0.1.2 May 28, 2013
    • Removing wrong number on submit
  • v0.1.1 May 27, 2013
    • Add Help task
    • Standardize logs
    • Bug fixes
  • v0.1.0 May 26, 2013
    • Allow log handlebars template from string
    • Move apply replacements logic to logger
      • Use handlebars templates instead of strings
      • Refactoring template integration with logger
      • Rename pull request --comment to --message
      • Add Issues task
  • v0.0.7 May 24, 2013
    • Add pull request forward command
    • Add Travis continous integration with JSHint
    • Create a new website under gh-pages branch
    • Update dependency version: git-wrapper@0.1.1
    • Add Hello World and Notification tasks
  • v0.0.6 May 17, 2013
    • Add ability to merge or rebase pull request
    • Add base.getUser and git.merge helpers
  • v0.0.5 May 16, 2013
    • Add login to be invoked by default in series
  • v0.0.4 May 16, 2013
    • Create ~/.gh.json if needed
  • v0.0.3 May 16, 2013
    • Merge user ~/.gh.json with default .gh.json
    • Add default .gh.json
    • Fix bin path
  • v0.0.2 May 16, 2013
    • Add fetch, open/close, message
    • Use moment humanize utility
  • v0.0.1 May 14, 2013
    • Initial commit

License

BSD License

Keywords

FAQs

Package last updated on 10 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc