sebastiandaschner blog


GitHub on the command line

#git #commandline monday, december 16, 2019

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 and hub browse -- issues which opens in the browser

  • hub 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:

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.

Update 2020-02-16: You also might want to have a look at the new GitHub CLI which just has been announced.

 

Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java: