Newer Post

American Idol Gets Voting Via Google

Older Post

Missouri just discovered what we've known all along

Speed up your GitHub workflow with Hub

As awesome as Github’s web interface is, trying to use it alongside your terminal can be rather time consuming and may slow down your workflow.

Why couldn’t you just perform all your common actions straight from the CLI? Well, you can. And it’s not just another homemade application. It comes straight from GitHub itself.

Let me introduce you to Hub, a simple wrapper around Git’s CLI which allows you to make any operation that can be done with GitHub’s API.

Opening pull requests, issues or forking are just a few basic and helpful things that’ll make your life better.

Installation is pretty straight-forward. Nothing fancy.

Or if you’re not an OSX user, you can install it straight from a source.

Basic repositories actions

Let’s start from the most common scenario, creating and forking a repository for a new project.

The regular process using a CLI looks like this:

It doesn’t look like something that can be done within seconds. Let’s now look how you can do the same thing using Hub:

If you want to repeat the first scenario using the origin/upstream naming convention, all you need to do are two additional steps:

That’s all. Everything straight from your terminal with a few simple steps.

You could even write a small script, which could execute all those commands for you.

Everything that you need to remember is to correctly set your global Git config.

Remotes management and fetching data

Now let’s say that after few days into your project, you need to get some changes from multiple forks from your teammates.

Instead of manually adding all remotes and fetching them, you can do the same thing in one step.

Instead of using:

you can now just type $ git fetch <username>, <username>, <username> which will repeat above operations for every comma-separated user for you.

Maintaining commits

Want to do a QA or local code-review for a friend?

I assure you that $ git checkout<username>/<repo>/pull/<PR.number> is much smoother and easier to type than:

Or maybe you just want to grab one commit from your friend’s fork without all remote/fetch/cherry-pick hassle.

Easy: Just use $ git cherry-pick<username>/<repo>/commit/<commit-hash> and all changes will be applied to your current branch.

Pull requests

And the thing that saved me the most of my precious time. Pull requests straight from a CLI.

As simple as that. You don’t have to go to, select repos, branches, etc.

By default, Hub opens a pull request for an origin/master. If you want to use this shorthand you have to set your main repository remote as origin and <username> as your fork.

If you want to use any remotes names, you can specify BASE and HEAD for a pull request using -b and -h flag.

One helpful tip from the official Hub page: If you’re making a new PR, append | pbcopy to the whole command. This way you’ll instantly get the PR URL copied into your clipboard, ready to post into a ticket or send to co-workers.

Additional shortcuts like opening your GitHub project on a specific page like git browse or git browse -- issues are just a cherry on top, but it’s always good to keep them in mind.

There are many more commands which Hub provides. If you want to wrap your head around it, you can find the documentation in the official project manual


We'll help you unleash.

Join the 20,000 developers who subscribe to our newsletter.

Scale your
Development team

We help you execute projects by providing trusted developers who can join your team and immediately start delivering high-quality code.

Hire Developers
code, github