How to use GitHub

Enspiral Dev Academy is a Web Development school in Auckland and Wellington, New Zealand. Graduate Timothy Tolley shares this piece from CodingAli.com, a content hub for everything tech and code. He wrote this during Week One of Bootcamp.

Tim and Maddie at Enspiral Dev Academy Auckland

While learning programming languages has taken up the majority of my time over the first part of my web development journey, using a platform called Github has been hugely important to the process so far. Github is an extremely powerful service which is used by developers the world over, currently boasting over 26 million users. Its main goal is to help developers code effectively and efficiently. How the platform achieves this is two-fold. Firstly, it allows developers to store their work in the cloud while maintaining a history of changes made to their documents. Secondly, Github acts as a hub for sharing work, whether it be through co-working or peer review, allowing for teams to work on projects in tandem.

My experience of Github has been one of frustration and confusion followed by the realisation that I have learnt something which I am now going to be using constantly in my working life. During the many jaunts I have made into online forums while trying to figure out how to use Github effectively, I have noticed that many of those who have been struggling to use the platform are intermediate to advanced programmers. I think that shows the importance of learning how to use software like Github early on. I mean, how much better will it look to go into a job interview and say “I am well practiced at using all aspects of Github to work with my team efficiently” rather than saying “I am able to google how to use Github when I need to use it.” Don’t get me wrong, I am a big advocate for google learning but learning to use Github early on has been unbelievably useful.

Now before I go too much further I’ll give you a quick overview of how Github works. Github is a website on which its users create an account. These accounts are just like your computer’s hard-drive, you have folders (here called repositories) and subfolders, and files in various formats. The main thing to recognise when dealing with Github is that you have a version of your entire repository both on your computer and your Github account. When you change a file on your computer, you can use Git commands to send these changes to your Github. These changes are then recorded allowing you to jump back to a previous version if you make a mistake later — just like pushing undo in word but a bit more useful. So, that’s the crux of the platform — user writes code, account stores a history of all changes made, user has the freedom to code without the worry of losing previous work — simple.

The magic of Github comes, however, in some of its more advanced features. The ability to work with a team is a huge part of programming in any form, as programmes and websites are made up of huge amounts of code in various formats which often can’t all be created by a single person. Github helps to make this happen by allowing multiple contributors to access a single repository and even work on the same document in tandem. Using different duplicate copies of the same document (called branches) and then merging the end results allows developers to work on different sections of a document while also maintaining a traceable history of changes. It is branching and merging that many who use Github struggle to get the hang of but it is these features which give the platform its real power. When trying a new idea or section of work, it is a relief to know that you have the fall back of a clean master branch waiting in case of some unknown upset. Equally, branching reduces error by removing the need for copying pasting others’ code into a final document as merging shows any conflicts that may arise within the document. For me branching and the ability to co-work using Github will be particularly important as I hope to be able to travel while still working in a team as I continue learning on the job.

After branching, one of the hardest thing to learn is Git, the commands used to communicate between your computer and the Github server. You can try to rope learn all the commands but for me the best way to figure out how it all works was to use it and use it constantly. Git is effectively a very small language which is used like the buttons on a TV remote, it won’t change channel without them. Using the command line of your computer, Git commands allow you to send your changes to the Github server, make a new branch, and move from one branch to another. Once you get the hang of these commands it’s quite straight forward and as they say — practice makes perfect.

There are many more advanced features of Github which can help programmers share their work and program more effectively. However, the most important one that I have come across in terms of learning the basics of development is the ability to create your own live website using the github.io domain. While Github’s built in websites are a little slow in updating and a little clunky in their namesake, they are a great way to start learning how to push a site live. Mine has become a place where I can share projects and reflect on the learning process, although it’s still definitely a work in progress.

As I said earlier, I have spent a lot of time figuring out how to use Github effectively recently but it has been well worth the effort. The security that Github provides in maintaining a revertible history is unbeatable when you’re spending half your time working out solutions using trial and error. Equally, being able to have my work peer reviewed with comments from my fellow students has been a real help when working out the small missteps in my code. It’s a real lifesaver. Not to mention, it’s made all the more worth it knowing that I’m preparing myself for a life of sun, sand and code.

Until next time,

Tim Tolley

Check out CodingAli.com for more insights into the tech world.

If you’d like to learn the skills to begin your journey into technology, upgrade your career, and open the door to more creative, well-paid work that you can do from anywhere in the world, apply for Dev Academy today.