2 min read

GitHub introduced ‘Hub’ that extends git command-line with extra functionality to enable developers complete their everyday GitHub tasks right from the terminal. Hub does not have any dependencies, but as it is designed to wrap git, it is recommended to have at least git 1.7.3 or newer. 

Hub provides both new and some extended version of commands that already exist in git. Here are some of them:

  • hub-am: Used to replicate commits locally from a GitHub pull request. 
  • hub-cherry-pick: Allows cherry-picking a commit from a fork on GitHub.
  • hub-alias: Used to show shell instructions for wrapping git. 
  • hub-browse: Used to open a GitHub repository in a web browser.
  • hub-create: Used to create a new repository on GitHub and add a git remote for it.
  • hub-fork: Allows forking the current repository on GitHub and adds a git remote for it.

You can see the entire list of commands on the Hub Man Page. Most of these commands are expected to be run in a context of an existing local git repository.

What are the advantages of using Hub

  • Contributing to open source: This tool makes contributing to open source much easier by providing features for fetching repositories, navigating project pages, forking repos, and even submitting pull requests, all from the command-line.
  • Script your workflows: You can easily script your workflows and set priorities by listing and creating issues, pull requests, and GitHub releases.
  • Easily maintain projects: It allows you to easily fetch from other forks, review pull requests, and cherry-pick URLs.
  • Use GitHub for work: It saves your time by allowing you to open pull requests for code reviews and push to multiple remotes at once. It also supports GitHub Enterprise, however, it needs to be whitelisted. 

Hub is not the only tool of its kind, there are tools like Magit Forge and Lab. Though developers think that it is convenient, some feel that it increases GitHub lock-in. “While it is pretty cool, using such tool increases general lock-in to GitHub, in terms of both habits and potential use of it for automation of processes,” a user expressed its opinion on Hacker News

Another Hacker News user suggested, “I wish there was an open standard for operations that hub allows to do and all major Git forges, including open source ones, such as Gogs/Gitea and GitLab, supported it. In that case having a command-line tool that, like Git itself, is not tied to a particular vendor, but allows to do what hub does, could have been indispensable.

To know more in detail, check out Hub’s GitHub repository.

Read Next

Pull Panda is now a part of GitHub; code review workflows now get better!

Github Sponsors: Could corporate strategy eat FOSS culture for dinner?