Github is an open source online service that allows coders to host and share their work and do a whole lot more. If you are a regular WordPress user, then you will have probably heard of themes or plugins being hosted or available to download from Github.
You might’ve even heard of the term forking too. But what exactly is Github and why should casual WordPress users be interested in it? Read on to find out more in our beginners guide to Github for WordPress users.
What is Github?
Github can be described as an online code repository, however any files can be hosted on the service and not just programming or coding related files. Github has been built around the Git software and is a web based interface for working with these types of files.
When it comes to WordPress developers, Github is a popular place to upload and share plugins and themes. With an active community of WordPress developers, its a great service to use in order to find projects to collaborate, on as well as locate resources for developing your own projects.
The Git software offers revision control and source code management and Github is the most popular online place to host and share these files. As Github specialises in offering collaborative revision control, it is ideal for those looking to work with others on the same projects.
In even more simple terms, it could be compared to a cloud file storage service such as Dropbox. This is because it offers online sharing of files, along with revision control, taking snapshots of the various versions of a file as it changes an evolves.
However, what makes Github so popular with developers is the ability to collaborate on projects. The simple way that project repositories can be copied by another user, or forked, then worked on independently, before the changes are merged with the original project, makes it an invaluable tool for developers.
Throw social networking features into the mix and you’ve got a recipe for success.
Article Continues Below
What is Forking?
In the world of Git files and Github, forking is the act of copying a repository over to your account. You would do this if you want to contribute to an existing project, or start your own project using an existing project as your base. The source project could belong to anyone, as long as it is made available on Github.
When a project repository is forked, instead of performing just a regular copy and paste, forking keeps the connection between the two repositories. This means that the changes made to either version, can be pulled over to the other repository. This pulling feature works in both directions so the changes made to either repository can be pulled to the other.
How Forking Works
If I want to add some new functionality to an existing WordPress plugin hosted on Github, I could fork the repository. Then download my copy of the project and start making my changes to the code. Once I was happy with my work I could commit the changes in order to upload it to my profile on Github. After that I could issue a pull request to attempt to have my changes included in the original repository. The manager of the original repository could decide whether to accept my request or not.
Because of the way Git works, the changes I had made to my forked repository would be merged with the current version of the source repository, thus updating the original plugin or theme. If any changes had been made to the source repository since I downloaded my forked version, they would not be overwritten during the merge. This is even if my version does is no longer the latest version of the plugin, theme or code.
Why a Social Network too?
Another core component of Github is the social network-style features it makes use of. Users create profiles and can follow each other. Many developers of popular WordPress plugins can be found on Github, where their work can be followed, forked, downloaded and installed.
By adding this social element to the site, Github has made it a great place to collaborate with other developers in your niche. It also makes it easier to decide whether to accept changes made to your repository, as you can view a user’s profile and gauge their experience and credibility as a contributor.
Installing Plugins from Github
Lots of popular and lesser known WordPress plugins can be found on Github. One way to install those plugins is to find them on Github, download the zip file and then upload it into your site.
However, there is also a plugin available which allows you to search Github for WordPress plugins, and then install them as you would a plugin hosted at the WordPress.org repository.
As you would expect the Github Plugin Search plugin can be downloaded from the code sharing site and installed manually. After that you can begin searching for plugins that are available on Github and install them directly to your site.
When looking around Github, it’s possible to find open source versions, or at least open source plugins that offer the same functionality as premium WordPress plugins. The Stripe add-on for WooCommerce is one such example.
I hope this very high level overview of Github has covered some of the basics accurately. If you’ve been curious about Gits, Hubs, Forks and the plugins that are uploaded to and available on the site, then you should now have some basic info to help you delve deeper into the service or back away now, knowing it’s not for you.
What has been your relationship or experience with Github and WordPress related code?