The Git Gud Guide

Have you ever lost an entire project due to a hard drive malfunction? No? You’re lucky then. But don’t push it.

For the rest of us, this could have been avoided by using a backup of some kind, such as one on the cloud.

But manually managing backups is a pain, especially when you’ve got multiple projects.

Shifting gears for a moment, have you ever worked on a team of size greater than 1? If you’re the main keeper of the project files, having to put in everyone’s changes is kinda annoying compared to if they could just do things themselves….

Introducing version control (git is one of the most popular, if you know of others you can use them instead)! The solution that people use to manage large projects with multiple people contributing to them at any point in time.

Now I know some of you are probably breaking out in hives right now at the idea of having to do anything on the command line, but you’re only gonna need to be able to do like, 5 things total. Most of the advanced usage is not necessary for most VN projects.

Getting Git

Okay, so OS check. If you’re running a mac or Linux, you should already have git installed to begin with. For those of us windows people there’s this. All the normal default options should be fine.

You can check to make sure git is installed by opening up a command prompt/terminal and typing

git --version

If it complains that it doesn’t know what git is, you don’t have it installed. If it tells you version information, you’re good.

Getting a Repository

There are plenty of options of where you can get a repo from, but I’m going to recommend two in particular: GitHub, and GitLab. I personally use GitLab now because it was the only one I knew of at the time that offered private repositories for free users, but GitHub also does that as of very recently, so choose your favorite.

Either way, you’re going to want to create a COMPLETELY EMPTY repository. This means that when you make a new one you don’t check that “intialize with a readme” option.

Setting up the Repo on your Computer

The next thing you want to do is clone your empty repo into wherever you want the project to reside.

Shown here is a screenshot from the Ren’Py GitHub repository. You’d copy that URL to use when cloning.

Open up a command prompt/terminal or git bash (which you can install along with git for windows if you like). Navigate to wherever you want the repo to live on your machine (hint: the command ‘cd’ changes the directory. If you have git bash from the windows install you can also right-click on it in file explorer and have an option to open git bash already in that location). Then, type this.

git clone insertURLhere

It will automatically make a folder for your project to reside in with a name that matches the repository name. Because we have nothing in our repo yet, it’ll be empty, but that’s fine.

Next step is to initialize your project files. If you’re using an engine you’d just make a new project in this folder. If you already have an existing project you can just copy files over here. Once you’ve got your files in place, go back to your command line and type:

git add .
git commit -m "Initial commit message"

This will make it so your changes (in this case adding the files) are saved and ready to go, but they won’t be reflected in the central repository yet. In order to do that you need to:

git push

Once you do that (it’ll probably pop up a login screen for you at some point too), you can check your repository on the site you chose and you should see your project files there.

Getting Your Teammates On the Repo

Make sure that you, as the repository owner, have enabled permissions for your team members to be able to read and write to the repo. Otherwise they can’t do it. Make sure they have git installed too. Then they need to

git clone insertURLhere

As well, into wherever they want the files to go. This time, since the repo isn’t empty, they’ll get whatever’s there to begin with.

Getting Updates

If someone’s made changes to your repo that aren’t on your local yet, you can grab them by typing:

git pull

This will only work if you’re actually IN the repo folder though.

Making Changes

Now everyone can work on the project as they please. Once they’re ready to upload their changes (which is a thing that should be done frequently), they can do the following:

git add .
git commit -m "insert some description of the changes made here"
git pull
git push

Why are we pulling again? Because someone might have made changes in the mean time that we don’t know about. If you’re already up to date pull won’t actually do anything to your files.

Did Your Updates Break Stuff?

That’s okay, git keeps a record of all the versions of all the files so you can roll back changes to get back to a working state. You can do this via the command line but you’ll probably be more comfortable doing that through the browser for your repo site. So the exact way to do that will vary, but your site should have information on how to do that.

Summary

There’s a lot more you can do with git in particular and version control in general, but most of it is overkill for small projects/teams, so don’t worry about it, at least for now. Here’s a list of all the commands we learned which are all you’ll need like 95% of the time.

git clone
git add
git commit
git pull
git push

But I still don’t want to command line!

That’s cool, there are a number of tools that you can get to sit on top of git and give you a more point and click experience. GitHub has their own app, for instance, and this is also a thing.

Author: Elaine Podosek

Space Point Games
Lead Writer and Programmer for Space Point Games.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.