Open a Github Repo Quickly from the Command Line

If you are a sysadmin or developer that uses a lot of repos throughout the day, and you use Github, this little snippet will come in handy. No more opening a browser window and fumbling around trying to navigate to your repo. Just type gh anywhere inside your project path and a browser window will open your repo on Github.

For this to work, you’ll need to do two things:

  1. Copy the snippet to ~/bin/gh
  2. Make it executable by running: chmod +x ~/bin/gh
  3. Reload or restart your terminal, browse into a Github project, type gh and boom!

A Git App for Sysadmins

I’ve tried a lot of different Git apps. And let’s be clear about one thing: when I say Git, I mean Github. Our shop works exclusively with Github, and as a sysadmin, I regularly need to compare different branches both locally and remotely. A sysadmin’s need for a Git app might be slightly different than a developers need. In my case, I’ll work with 20-30 different repos in a week. Where a developer might only work inside one or two. Different apps for different needs. But this app in particular rises to the top when you need to answer the question: “What the fuck is going on with this branch?”

Enter GitX

In my opinion, this app is the GUI that should come default with Git instead of gitk. Sure, you have all of these features available to you at the command line, but GitX helps when there are a lot of changes in the diff. Here is a screenshot of my most-used feature, comparing branches. With the develop branch checked out, you can right click on any branch, local or remote, to easily see the diff between the two.

I really like the way diffs look in GitX too. A lot of apps get this wrong:

This is great when branches already have been committed. But GitX also works really well for developers who haven’t made commits or staged changes yet. The developer that introduced me to GitX says that he pulls up GitX before every commit just to get one last visual before committing changes to the repo. Check out this staging viewer. So awesome to be able to see unstaged and staged changes quickly in a single view, then commit staged items in one fell swoop: