Why you should use GitHub

GitHub is one of many services where you can upload your code for version control. The basic idea behind version control is that code projects tend to become big and messy and version control makes the project less messy - especially if many people are working with the same project.
I think it was last year I really started to use GitHub for my code projects. I had several years earlier tried to start using GitHub but I stopped because I think I felt GitHub was confusing to use and I didn't really need it. But last year I found Sourcetree which is making GitHub less confusing to use (you don't have to memorize git commands). I also learned that GitHub has started to allow free private repositories - when I first started using GitHub all code had to be available free to everyone which is obviously not good if you are working on secret projects. So now I've put almost all my code on GitHub.

If you are working with a team then you almost always need to use GitHub or some similar service. But why should you, as an individual user, use GitHub?
  1. Backup. It's never fun when your computer crashes and your projects disappear into the darkness. To backup your projects you can copy-and-paste them into some backup software like Google Drive och Dropbox. This is working fine but can be a little annoying if you make many updates. With GitHub you can backup your projects with just a few clicks. You should still use another backup method because you can't trust GitHub - there's always a small probability that they will mess up and your code is gone forever, so it's always better to be safe than sorry. 
  2. Easier to experiment. Let's say you want to experiment with an idea you have and this idea involves deleting some code. Now deleting code for experimental purposes is never good because the experiment might fail and then you have to recreate the deleted code. With GitHub you can start different branches, which will split your code into branches and you can easily change between each branch to compare the experiment with the original code. If you are not happy with the experiment, just delete the branch.    
  3. You don't need to be tech support. What I've done lately is to publish some of my Unity tutorials on GitHub. I earlier had this pedagogical idea that people will learn more if they read the tutorial instead of copy-and-pasting from GitHub. But people will sometimes fail, so they will e-mail you and you have to spend time trying to solve their problems. It's also much easier to update code through GitHub than to update the code you earlier copy-and-pasted into html. So publishing your tutorial code on GitHub will save you time and energy.
  4. Free marketing. Something I realized after putting my code on GitHub is that people also found my code through GitHub's search function - they didn't come just from the original site. GitHub has a small, but still adequate, analytics page where you see from where people found your code. So if you want people to find you code you should put it on GitHub because it might be difficult to make people find your code by just making your original site rank higher in the search engines. And if you link your Twitter account from GitHub you will also get a few extra Twitter followers! 
  5. People will test the code for you. GitHub has this function where people can easily report issues with your code, which is really good because it might be difficult to test the code on your own.  

So how can you start learning GitHub with Unity if you have no idea where to begin? I think this tutorial is a good start: Using Git with Unity Tutorial [2019]. It will teach you how to use GitHub with Sourcetree. Atlassian, the creators of Sourcetree, has also created this online course: Version Control with Git, which you can go through in a few hours and it will teach you a little more than just the basics.

If you are interested in visiting my GitHub account you can find it here: github.com/Habrador

Comments