Only thing more confusing that GitHub’s OctoCat is GitHub itself! Until now — come inside, let me explain…
So let me be clear — the picture above may make your head explode.. well just try to open GitBash and have a play and you will probably have the same result. Thanks God for tutorials.. so let me do the hard mucking for you and just flat out explain how to make it easy (and it actually is quite easy once you play around).
What is it? Well, GitHub is basically a code hosting platform for version control and collaboration. You can store your code there and make different versions of your project for ease of use. It makes working in a team extremely easy as you all will have access to the project and the projects “branches” or “tentacles” (I suppose is better suited here). That my friends is a very basic explanation. It does so much more.. but for the purposes of my article and learning the basics of it, I will only dip a toe in.
First, the easy part. Let’s download it and get it set up. First, head on over to https://git-scm.com/downloads and download whatever version it is you need. You should see the below image on your screen:
Ok, so install that bad boy. Just go through the options as you normally install anything — nothing major to change or adjust here other than maybe where you want to install it. Once that is done…
Ok, so if you did any old dos work then you will understand some of what I’m going to explain — things like cd for example. Let’s begin..
So in this small example I will show you how to get to the directory of your Unity game. This is where the files are that you are going to be saving to the GitHub server.
In my case I saved all of my projects to a Unity folder on my Desktop. To find this file in Git Bash you can do it the long way, or, the easy way. I’m not sure why I’m even going to show you the long way other than it will give you some hands on experience in exploring the app.
The Long Way
So to start, this isn’t actually a very long ordeal. But it is a bit more typing than the easy way. The short way is 3 easy steps, the long way, 3 easy steps (hahaha.. ahem).
1. - First, open Git Bash. But first first make sure you know where your Unity files are saved (In my case it is Desktop/Unity/Version Control Example). Once you have that look back inside Git Bash and you will see a line of code at the top that is basically just a link to files inside of your computer, the important part is the $ and |that come after that. This is where we are going to start. No, you aren’t going to get money (I didn’t think I would…. ahem). So type this:
ls and hit enter.
A long line of mumbo jumbo will appear. Don’t panic, you didn’t break anything (yet). There will be a scroll bar on the right that you can scroll up or down. Find the folder that you have your Unity game save in.
2. — Type:
Exchange Desktop with whatever path you have, it may be documents, Games, whatever.
3. - Third, make note of what it says after the line of code at the top. It now says /desktop (or /documents or /game or whatever you had). Now, you are actually inside of that desktop folder. Everything that is inside of the actual Desktop folder you will now see when you type:
Now you will see all of the files that are inside of the folder you have the Unity game saved. In my case, Unity. Type:
Now, I’m inside of the actual Unity folder that I made to put my games in.
You know what that does by now! It shows you everything that is inside the Unity folder. NOW you can find the actual game you saved. In my case:
cd Version\ Control | Example/
And that as they say in the industry is… uhm… sorry I’m not in the industry yet, but let’s just say that’s that.
The Short Way
Ok, so now that you’ve beat your head against the desk after reading the “long way”.. let’s show you the short way in 3 easy steps (this time I’m serious). This, my friends is going to make you glare at me through your computer after looking at the long way. But remember, before you shoot off hate mail to me, I gave you a solid 5 minutes of learning some of the ins and outs that you will need to know — the cd’s and ls’s and things like that :)
Remember, my game is saved on a folder called Unity on the Desktop.
Desktop\Unity\Version Control Example to be exact. So get this..
1. Open the Unity folder.
2. Open Version Control Example folder.
3. Right click inside folder and click on Git Bash Here.
That’s it… that’s all. That will now open Git Bash and already be inside the folder you need.
Now, before you slam your laptop shut or storm away from the computer let me wish you luck on your journey in Unity and programming. I’m already loving mine.
Tomorrow we will be starting coding with more information about Git Hub and how we connect Unity to Git Hub and start to push and pull some files around.
Until then, happy clicking!