A significant roadblock in starting any new venture is planning ahead. This requires you to know where you want to end up, and how you need to begin. The first part is easy, but working backwards to uncover the first step isn’t.
Normally, I’d dive into this experience and let harsh reality be my guide. Nothing teaches a lesson like tragedy and frustration, right? But on the other hand, nothing kills motivation quicker.
Determined not to shoot myself in the foot, I’m going to give myself the gift of version control. Thankfully, there are a myriad of tools available now that poor, novice, 8-year-old junior coder me didn’t have access to. Like git!
Click the link above to get git (he he) and let’s git… er get started. Once it’s downloaded and installed, boot that sucker up and we get this helpful user interface:
Lucky for me, I got my start swimming the seas of DOS. So this is like riding a bike for me. Some people may be a bit intimidated by this interface, and if that’s you, don’t worry. It’s super easy to get help inside the program. In fact, let’s do that now.
So, first things first: we need to link this thing to a repository. I’ll be using github (and the rest of this article will assume you are too). Creating an empty repository is simple enough. Click the shiny green “New” button, and you should have something like this:
Name your repository after the project you’re working on. I’m going with “Version Control Example.” Make sure to check “Add .gitignore” and select Unity from the dropdown. This will make sure git ignores all the files that Unity generates in your project directory which you don’t need.
Next, you’ll need to get a link to your repository so we can put it in git. Click the green “Code” button and copy the url in the resulting dropdown.
Navigate to the Unity project folder on your computer and right click in the folder. You’ll see on your right click menu a couple of new options for git. The one you want is “Git Bash Here.”
Once the console opens, enter “git init” as shown below. This will link git to your project.
Now we’ll add the url we copied earlier with the following command: “git remote add origin [url]”
If you type “git remote -v” you should see your server url named “origin.”
And that’s it! Git now knows where my project files are and where to put them when I push out new changes. With this handy tool I should save myself a LOT of frustration down the line.
In the next article I’ll cover installing Unity and getting started with game development. I hope you’ll check it out.