GitHub on the command line
hub is a command line client for GitHub. You can use it to view or create issues, pull requests, conveniently fork or check-out repositories, and much more.
I frequently use the following commands:
hub clone <org>/<repo>
hub browse
andhub browse -- issues
which opens in the browserhub pull-request
hub issue create
Hub is repository- and branch-aware and the commands usually work as expected. It works with both the public GitHub and GitHub Enterprise. If the GitHub repository defines templates for issues or pull requests, you can use them similar to the following:
1 | hub issue create --edit -F .github/ISSUE_TEMPLATE/bug_report.md |
Furthermore, you can setup an alias for git
that redirects to hub
, since hub wraps all normal Git commands as well.
Have a look at the website or the man page for more examples.
Some of the content of this post was reposted from my newsletter issue 035.
Published on Java Code Geeks with permission by Sebastian Daschner, partner at our JCG program. See the original article here: GitHub on the command line Opinions expressed by Java Code Geeks contributors are their own. |