Github Extensions

Jeroen Visser
Jeroen’s Personal blog
3 min readSep 14, 2014

--

Over the last couple of days, I’ve been working on some Github extensions that extend to the features Github is already offering.

Github Extensions

Github Black (Gothub)

Github Black

I really fancy the Github Enterprise layout. Technically, it’s just a black navigation, but it looks really good! For those who want the technical details:

  • It works by adding a class to the body (enterprise). The styles for enterprise are delivered in the default CSS file.
  • To prevent a FOUC from happening at page load, we already provide the styles without the enterprise class, so they appear as default.

You can find this project by heading over to my repo here.

Git-Flow for Github

Git-flow is a workflow within Git. It’s not only bound to Git, because you can also use it in Mercurial, but as the name suggests it’s mostly used within Git. The main idea is that you have two types of branches, feature and hotfix branches. A feature is created from the develop branch, whereas a hotfix is created from master. Therefor, when you want to work with pull requests (for code-reviewing, for instance), you have to manually compare it to either master or develop. This goes wrong, a lot of the times.

In our company, we changed our default branch to be develop, as this was the branch with most of the activity. This also meant that we didn’t had to think about changing the compared branch when creating a feature. Although still having this problem with hotfixes (which later turned out to be worse, as they mostly come with a little more stress), it was now a little easier to create a feature.

This was not a solution that would be easy to keep. As it turned out, there were a lot of mistakes happening. Github also does not allow to change the compared branch when the PR has been created, so you would have to close it, find the branch, compare it to master this time and create a new PR.

So what I did was I created an extension for Chrome (and Safari) that would change this. The main problem was the compared branch being incorrect, but there was also this problem with the automatic title generation of Github. Our branches would look something like hotfix/icepay_new_api_implementation. Github would try to automatically come up with a title that would look like this: ‘Hotfix/icepay new api implementation’. This would not be the thing we want.

So let me explain what the extension itself is doing.

  • It checks the compare page, and if it’s currently on the compare page, it:
  • …checks if the compare is done against the default branch. If so, we check if it’s either a hotfix/ or feature/ prefixed branch. If that is the case, then we:
  • …redirect the user to the right compare page for the branch type
  • …we correct the auto-generated title and remove the prefix.
  • …we add a pull request template to make code-reviews easier.

That is, in a nutshell, what the extension does. It enables Git-flow in Github, which is pretty nice! If you want to try it out yourself, you can download it here!

You like any of these extensions, use them in your company or have ideas about how to make this even better? Please leave a comment!

--

--